[FFmpeg-user] Audio Desynchronization When Utilizing Segmentation

Gabriel Balaich roderrooder at gmail.com
Mon Mar 26 21:09:58 EEST 2018

On Mon, Mar 26, 2018 at 7:27 AM, Jim Shupert <jshupert at theppsgroup.com>

> On 3/25/2018 9:30 PM, Gabriel Balaich wrote:
>> -i video="Video (00 Pro Capture HDMI 4K+)"
>>> a question - what is your capture card?
> _______________________________________________
It is the Magewell Pro Capture HDMI 4K Plus:

Also just a few more updates, I assumed it was something to do with
negative time stamps but that doesn't seem to be the
case. After adding -segment_format_options avoid_negative_ts=make_zero the
problem persists:

ffmpeg -y -thread_queue_size 9999 -f dshow -video_size 3440x1440 -rtbufsize
2147.48M -framerate 100 -pixel_format nv12 ^
-itsoffset 00:00:00.015 -i video="Video (00 Pro Capture HDMI 4K+)"
-thread_queue_size 9999 -guess_layout_max 0 -f dshow ^
-rtbufsize 2147.48M -i audio="SPDIF/ADAT (1+2) (RME Fireface UC)" -map
0:0,1:0 -map 1:0 -c:v h264_nvenc -preset: llhp ^
-pix_fmt nv12 -b:v 250M -minrate 250M -maxrate 250M -bufsize 250M -b:a 384k
-ac 2 -r 100 -vsync 1 ^
-max_muxing_queue_size 9999 -f segment -segment_time 300 -segment_wrap 9 ^
-segment_format_options avoid_negative_ts=make_zero

Unless when shifting a negative time stamp to zero it is also shifts other
timestamps the same amount? I'm not really sure how
to view time stamps, so it's hard for me to know this is having any effect
at all. But if that is the case Maybe there is a way to
route that format option to only audio (per segment), but options seem
limited with -segment_format_options. Or I guess
options seem limited in general when applying any type of "option" or
effect per segment as opposed to the initial segment and
nothing after. I believe only options from 19.0 - 19.1 in the ffmpeg
documentation can be applied on a per segment basis,
correct me if I'm wrong. When trying -segment_format_options async=1 for
example it threw an error. Even if there was a way
for me to slightly delay the audio per segment perhaps I could alleviate my
issues to an extent, would be nice if I could find an
actual fix though.

I found a forum post on the "creative cow" forum by a user who seems to be
experiencing the same thing as me:

However he has a mic plugged into a camera directly, pulling video and
audio from said camera, and is still experiencing
audio drift when implementing segmentation. So I assume my issues have
nothing to do with my audio and video streams
coming from different sources. Unfortunately it seems no solution was found
in this forum post.

Every time I've thought that I hit a roadblock using ffmpeg I've always
found a way forward, even after searching for fixes for
weeks at time. I've been trying to figure out this last part for months,
things are looking dismal. Any suggestions at all, even
crazy ones, would be extremely appreciated.

More information about the ffmpeg-user mailing list