ffmpeg 转换跳过音频

发布于 2024-11-02 13:28:00 字数 1433 浏览 4 评论 0原文

使用 ffmpeg 将视频转换为 mp4 格式时,音频会被跳过,因为音频与视频不同步。

大家可以看一下下面的视频: https://vialogues.com/vialogues/play/486

我使用以下选项进行转换

/usr/local/bin/ffmpeg -y -i $inputfile -acodec libfaac -ar 44100 -ab 96k -vcodec libx264 -level 41 -bufsize 20000k -maxrate 25000k -g 250 -r 20 -s 480x270 -coder 1 -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -flags2 +dct8x8+bpyramid -me_method umh -subq 7 -me_range 16 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -rc_eq 'blurCplx^(1-qComp)' -bf 16 -b_strategy 1 -bidir_refine 1 -refs 6 -crf 25 -deblockalpha 0 -vpre medium -deblockbeta 0 $outputfile

另外 ffmpeg 版本是

ffmpeg
FFmpeg version 0.6.1, Copyright (c) 2000-2010 the FFmpeg developers
  built on Feb 19 2011 19:03:56 with gcc 4.4.5
  configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-x11grab
  libavutil     50.15. 1 / 50.15. 1
  libavcodec    52.72. 2 / 52.72. 2
  libavformat   52.64. 2 / 52.64. 2
  libavdevice   52. 2. 0 / 52. 2. 0
  libswscale     0.11. 0 /  0.11. 0
  libpostproc   51. 2. 0 / 51. 2. 0
Hyper fast Audio and Video encoder

关于为什么会发生这种情况的任何想法吗?

While converting a video to mp4 format using ffmpeg the audio gets skipped because of which the audio goes out of sync with the Video.

One can have a look at the following Video:
https://vialogues.com/vialogues/play/486

I am using the following options for conversion

/usr/local/bin/ffmpeg -y -i $inputfile -acodec libfaac -ar 44100 -ab 96k -vcodec libx264 -level 41 -bufsize 20000k -maxrate 25000k -g 250 -r 20 -s 480x270 -coder 1 -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -flags2 +dct8x8+bpyramid -me_method umh -subq 7 -me_range 16 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -rc_eq 'blurCplx^(1-qComp)' -bf 16 -b_strategy 1 -bidir_refine 1 -refs 6 -crf 25 -deblockalpha 0 -vpre medium -deblockbeta 0 $outputfile

Also the ffmpeg version is

ffmpeg
FFmpeg version 0.6.1, Copyright (c) 2000-2010 the FFmpeg developers
  built on Feb 19 2011 19:03:56 with gcc 4.4.5
  configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-x11grab
  libavutil     50.15. 1 / 50.15. 1
  libavcodec    52.72. 2 / 52.72. 2
  libavformat   52.64. 2 / 52.64. 2
  libavdevice   52. 2. 0 / 52. 2. 0
  libswscale     0.11. 0 /  0.11. 0
  libpostproc   51. 2. 0 / 51. 2. 0
Hyper fast Audio and Video encoder

Any ideas as to why this would be happening?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

↘紸啶 2024-11-09 13:28:00

我做了很多研究并使用了 ffmpeg 的异步选项,我发现出现了唇形同步问题,因为音频被 libfaac 下采样,所以我更改了 --acodec 的选项来复制,这实际上意味着不要对其进行下采样并将其放入原始格式。

此后问题就消失了。

/usr/local/bin/ffmpeg -y -i $inputfile -acodec copy -ar 44100 -ab 96k -vcodec libx264 -level 41 -bufsize 20000k -maxrate 25000k -g 250 -r 20 -s 480x270 -coder 1 -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -flags2 +dct8x8+bpyramid -me_method umh -subq 7 -me_range 16 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -rc_eq 'blurCplx^(1-qComp)' -bf 16 -b_strategy 1 -bidir_refine 1 -refs 6 -crf 25 -deblockalpha 0 -vpre medium -deblockbeta 0 $outputfile

一些有助于了解 ffmpeg 更多信息的链接是:

1) 谈论 FFMPEG 的工作原理:http: //howto-pages.org/ffmpeg/
2)将视频转换为quicktime:http://ubuntuforums.org/archive/index.html php/t-387640.html
3) 在 UBUNTU 上安装 FFMPEG : http://ubuntuforums.org/showpost.php? p=6963607&postcount=360

I did a lot of research and played with async option of ffmpeg, I found out that the lip sync issue was occuring because of the fact that the audio was getting downsampled by libfaac so I changed the option of --acodec to copy which effectively means don't downsample it and put it in the raw format.

After this the issue was gone.

/usr/local/bin/ffmpeg -y -i $inputfile -acodec copy -ar 44100 -ab 96k -vcodec libx264 -level 41 -bufsize 20000k -maxrate 25000k -g 250 -r 20 -s 480x270 -coder 1 -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -flags2 +dct8x8+bpyramid -me_method umh -subq 7 -me_range 16 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -rc_eq 'blurCplx^(1-qComp)' -bf 16 -b_strategy 1 -bidir_refine 1 -refs 6 -crf 25 -deblockalpha 0 -vpre medium -deblockbeta 0 $outputfile

Couple of links which were kind of helpful in figuring out about ffmpeg more were:

1) Talks about how FFMPEG works: http://howto-pages.org/ffmpeg/
2) Converting video to quicktime: http://ubuntuforums.org/archive/index.php/t-387640.html
3) Installing FFMPEG on UBUNTU : http://ubuntuforums.org/showpost.php?p=6963607&postcount=360

夜灵血窟げ 2024-11-09 13:28:00

当我遇到类似的问题时,您的答案也是对我来说效果很好的一种解决方案。然而,复制音轨对我来说不是一个选择,因为我希望它被压缩,而原始音轨可能有 384kbps 的音轨。

但你提到的重要的事情是下采样的问题。那,以及这个线程(http://doom10.org/index.php?topic=1639.0)让我思考并开始尝试 aac 编解码器。它被认为是实验性的,但对我来说效果很好! -async、-vsync 什么也没做,但 -acodec aac -strictexperimental (为了 ffmpeg 不会警告你它是实验性的)创造了奇迹!强烈推荐此解决方案给任何有音频/视频同步问题并且无法复制音频且普通解决方案不起作用的人。 aac 是一个很棒的编解码器。我仍然会使用 libfaac 作为我的主要 aac 编解码器,因为 aac 是实验性的,但我很确定现在 acc 可以在生产中产生很好的结果并且保持一致。

Your answer is one solution that worked well for me, too, when I faced the similar problem. However, copying the audio track wasn't an option for me because I want it compressed, and originals might have 384kbps tracks.

But the important thing that you mentioned was the problem of downsampling. That, and this thread (http://doom10.org/index.php?topic=1639.0) got me thinking and into trying aac codec. It's deemed experimental, but it worked great for me! -async, -vsync did nothing, but -acodec aac -strict experimental (for ffmpeg not to warn you that it's experimental) did wonders! Highly recommend this solution to anyone who has audio/video sync problems and where copying the audio is not an option and ordinary solutions don't work. aac is a great codec. I'm still going to use libfaac as my main aac codec because aac is experimental but I am pretty sure now acc can produce great results in production and be consistent.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文