简体   繁体   English

ffmpeg音频和视频同步错误

[英]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.

相关问题 FFmpeg 自动同步音视频 - FFmpeg Automatically Synchronize Audio and Video ffmpeg分体| 合并视频语音不同步 - ffmpeg split | merge video voice not sync 使用ffmpeg将音频与图像和视频连接 - Concatenate audio with image and video using ffmpeg Ffmpeg 4 音频和 1 视频输入到 4 视频输出性能问题 - Ffmpeg 4 audio and 1 video input to 4 video outputs performance issue FFMpeg; 混合两个音频 stream 时出错 - FFMpeg; Error when mixing two audio stream ffmpeg 将所有音轨添加到视频转换 (mkv) - ffmpeg add all audio tracks to video conversion (mkv) 在Linux服务器上将PHP音频和视频上传链接到FFMPEG - Linking PHP audio and video uploads to FFMPEG on a linux server FFMPEG - 连接多个剪辑会产生损坏的输出(冻结视频、音频丢失、持续时间过长) - FFMPEG - Concating multiple clips produce corrupted output (freeze video, audio loss, lengthy duration) 将FileInputStream和FileOutputStream传递给ffmpeg进行转码(使用JAVE-Java音频视频编码) - Passing FileInputStream and FileOutputStream to ffmpeg to transcode(using JAVE-Java Audio Video Encoding) 如何运行命令行FFMPEG并接受多个管道(视频和音频)而不会阻塞第一个输入? - How can I run command line FFMPEG and accept multiple pipes (video and audio) without blocking on the first input?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM