简体   繁体   English

使用GStreamer播放mp4文件时同步音频和视频

[英]Sync audio and video when playing mp4 file with GStreamer

I need to sync video and audio when I play mp4 file. 播放mp4文件时,我需要同步视频和音频。 How can I do that? 我怎样才能做到这一点?

Here's my pipeline: 这是我的管道:

gst-launch-0.10 filesrc location=./big_buck_bunny.mp4 ! \
    qtdemux name=demux demux.video_00 ! queue ! TIViddec2 engineName=codecServer codecName=h264dec ! ffmpegcolorspace !tidisplaysink2 video-standard=pal display-output=composite \
    demux.audio_00 ! queue max-size-buffers=500 max-size-time=0 max-size-bytes=0 ! TIAuddec1 ! audioconvert ! audioresample ! autoaudiosink

Have you tried playing the video on a regular desktop without using TI's elements? 您是否尝试过在不使用TI元素的情况下在常规台式机上播放视频? GStreamer should take care of synchronization for playback cases (and many others). GStreamer应该注意播放情况(以及许多其他情况)的同步。

If the video is perfectly synchronized on a desktop then you have a bug on the elements specific to your target platform (TIViddec2 and tidisplaysink2). 如果视频在桌面上完全同步,则您的目标平台特定元素(TIViddec2和tidisplaysink2)存在错误。 qtdemux should already put the expected timestamps on the buffers, so it is possible that TIViddec2 isn't copying those to its decoded buffers or tidisplaysink2 isn't respecting them. qtdemux应该已经在缓冲区上放置了预期的时间戳,因此TIViddec2可能没有将其复制到其解码的缓冲区中,或者tidisplaysink2并未遵守它们。 (The same might apply to the audio part) (同样的可能适用于音频部分)

I'd first check TIViddec2 by replacing the rest of the pipeline after it with a fakesink and run with verbose mode of gst-launch. 我首先要检查TIViddec2,方法是用假冒接收器替换管道中的其余部分,然后以详细的gst-launch模式运行。 The output from fakesink should show you the output timestamps, check if those are consistent, you can also put a fakesink right after qtdemux to check the timestamps that it produces and see if the decoders are respecting that. fakesink的输出应显示输出时间戳,检查它们是否一致,还可以在qtdemux之后放置一个false接收器,以检查其产生的时间戳,并查看解码器是否遵守该时间戳。

我实际上使用了错误的视频帧率。

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

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