[英]ffmpeg audio and video sync error
./ffmpeg \
-f alsa -async 1 -ac 2 -i hw:2,0 \
-f video4linux2 -vsync 1 -s:v vga -i /dev/video0 \
-acodec aac -b:a 40k \
-r 25 -s:v vga -vcodec libx264 -strict -2 -crf 25 -preset fast -b:v 320K -pass 1 \
-f flv rtmp://192.168.2.105/live/testing
with the above command i able to stream with fps of 25 but their is no audio and video synchronization ie, audio is faster than video,i am using ffmpeg 0.11.1 version on the pandaboard for an rtmp streaming ,help me out to solve this problem. 使用上述命令,我能够以25的fps进行流式传输,但是它们没有音频和视频同步,即音频比视频要快,我在Pandaboard上使用ffmpeg 0.11.1版本进行rtmp流式传输,请帮我解决这个问题问题。
Thanks 谢谢
Ameeth 阿米斯
Don't use -pass 1
if you're not actually doing two-pass encoding. 如果您实际上没有进行两遍编码,请不要使用
-pass 1
。
From the docs (emphasis added): 从文档(添加重点):
'-pass[:stream_specifier] n (output,per-stream)'
Select the pass number (1 or 2).选择密码(1或2)。 It is used to do two-pass video encoding.
它用于进行两遍视频编码。 The statistics of the video are recorded in the first pass into a log file (see also the option -passlogfile), and in the second pass that log file is used to generate the video at the exact requested bitrate.
视频的统计信息在第一遍中记录到日志文件中(另请参阅选项-passlogfile),在第二遍中,该日志文件用于以请求的确切比特率生成视频。 On pass 1, you may just deactivate audio and set output to null , examples for Windows and Unix:
在第1遍中,您可以仅停用音频并将输出设置为null ,例如Windows和Unix:
ffmpeg -i foo.mov -c:v libxvid -pass 1 -an -f rawvideo -y NUL ffmpeg -i foo.mov -c:v libxvid -pass 1 -an -f rawvideo -y /dev/null
I was streaming to Twitch, and, funnily enough, removing the -r
option made video sync with the audio. 我当时正在流媒体到Twitch,很有趣的是,删除了
-r
选项使视频与音频同步。 Now, you might want to have the framerate limited in some way; 现在,您可能希望以某种方式限制帧速率。 unfortunately, I have no solution for that, but it does allow to sync the video with the audio very well.
不幸的是,我对此没有解决方案,但是它确实可以很好地将视频与音频同步。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.