简体   繁体   English

如何使用ffmpeg重新编码(x264有限)

[英]how to reencode with ffmpeg (with limited x264)

Until now I used this script to reencode my rips for my box (tv decoder): 到目前为止,我使用此脚本重新编码我的盒子(电视解码器)的片段:

^_^ ( ~ ) -> cat ~/++/src/convert.sh 
#! /bin/bash

name=$(path -r "$1") # it gives the file name without the extension

[ "$1" = *.mp4 ] && ffmpeg -i "$name".mp4 -vcodec copy -acodec copy "$name".mkv
x264 --preset veryfast --tune animation --crf 18 --vf resize:720,576,16:15 -o "$name".tmp.mkv "$name".mkv
mkvmerge -o "$name [freeplayer sd]".mkv "$name".tmp.mkv --no-video "$1"
rm -rf "$name".tmp.mkv
[ "$1" = *.mp4 ] && rm -rf "$name".mkv
exit 0

#EOF

It works on my ubuntu and archlinux laptops. 它可以在我的ubuntu和archlinux笔记本电脑上使用。 But it doesn't on my desktop witch runs fedora. 但这不是在我的桌面上运行的女巫。 Google says that the x264 package shiped by rpmfusion doesn,t support lavf and ffms2. Google表示rpmfusion随附的x264软件包不支持lavf和ffms2。 And I cannot unistall it because smplayer (witch i like) needs it. 我不能取消安装它,因为smplayer(我喜欢的女巫)需要它。

Ok, so I have to compile it. 好的,所以我必须编译它。 Google then says "you have to build ffmpeg, ffms2 tnen x264 ensuring that the flags are correctly refered." 谷歌然后说:“您必须构建ffmpeg,ffms2和x264,以确保正确引用了标记。” Well, didn't work (ffms2 cannot find LIBAV - even when I am telling where - and x264 does't configure with lavf...) 好吧,那没用(ffms2找不到LIBAV-即使我告诉了哪里-而且x264没有使用lavf配置...)

My question is: can I use ffmpeg alone to do what my script does. 我的问题是:我可以单独使用ffmpeg来完成脚本的功能吗? I have ffmpeg version 0.8.11, x264 0.116.2048 59cb2eb and gcc: 4.6.1 20110804 (Red Hat 4.6.1-7) 我有ffmpeg版本0.8.11,x264 0.116.2048 59cb2eb和gcc:4.6.1 20110804(Red Hat 4.6.1-7)

EDIT: Ok, I found that: ffmpeg -i input file -acodec copy -vcodec libx264 -preset veryfast -tune animation [that part I don't have] output 编辑:好的,我发现:ffmpeg -i输入文件-acodec复制-vcodec libx264-预设非常快的-tune动画[我没有的那部分]输出

I found it myself. 我自己找到的。

ffmpeg -i input -s 720x576 -aspect 4:3 -vcodec libx264 -preset veryfast -tune animation -crf 18 -acodec copy -scodec copy output

My script becomes: 我的脚本变成:

#! /bin/bash
#
name=$(path -r "$1") # it gives the file name without the extension

ffmpeg -i "$1" -s 720x576 -aspect 4:3 -vcodec libx264 -preset veryfast -tune animation -crf 18 -acodec copy -scodec copy "$name".tmp.mkv
mkvmerge -o "$name [freeplayer sd]".mkv "$name".tmp.mkv --no-video "$1"
rm -rf "$name".tmp.mkv
exit 0
#
#EOF

And it now works with any container! 现在,它适用于任何容器! you may change the tune and delete the "-scodec copy" part if you use it for other things than animation (well it will work either ways). 如果将其用于动画以外的其他用途,则可以更改该曲调并删除“ -scodec复制”部分(无论哪种方式都可以使用)。 you may also note that my tv is a pal 4:3 ratio one. 您可能还注意到,我的电视是朋友4:3的比例。 That may change too. 这可能也会改变。

See ya. 再见。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM