将.mkv转换为h.264 FFmpeg [英] Converting .mkv to h.264 FFmpeg

查看:301
本文介绍了将.mkv转换为h.264 FFmpeg的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用FFmpeg将.mkv文件转换为.mp4.我尝试了以下代码:

I would like to convert my .mkv files to .mp4 using FFmpeg. I have tried the following code:

ffmpeg -i input.mkv -c:v libx264 -c:a libvo_aacenc output.mp4

但是我得到了错误:

打开输出流#0:1的编码器时出错-可能是不正确的参数,例如bit_rate,rate,width或height.

Error while opening encoder for output stream #0:1 - maybe incorrect parameters such as bit_rate, rate, width or height.

有什么办法可以解决这个问题?我尝试设置音频的比特率,但问题似乎仍然存在.

Is there any way to get around this? I have tried setting the bitrate of the audio but the problem seems to persist.

推荐答案

我建议您首先检查.mkv文件是否首先已经具有H.264/AAC流.因为这样做,您要做的就是复制流并更改容器:

I suggest you first check whether your .mkv file already has H.264/AAC streams in the first place. Because if it does, all you have to do is copy the streams and change the container:

ffmpeg -i input.mkv -vcodec copy -acodec copy output.mp4

如果没有,您可能会被拒绝,因为您没有为libvo_aacenc指定比特率.请尝试以下操作:

If it doesn't, you probably got rejected because you didn't specify a bitrate to libvo_aacenc. Try the following:

ffmpeg -i input.mkv -c:v libx264 -c:a libvo_aacenc -b:a 128k output.mp4

但同样,如果您的.mkv已经包含H.264/AAC,请使用第一个解决方案.这样会更快,并且质量会更好.

But again, if your .mkv already contains H.264/AAC, USE THE FIRST SOLUTION. It'll be faster and will have a better quality.

这篇关于将.mkv转换为h.264 FFmpeg的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆