[FFmpeg-user] Compensating for missing audio frames at beginning of video

Ned Rockson nedrocks at gmail.com
Wed Dec 9 21:06:01 CET 2015


Hi,

I have a problem with audio syncing when using the amerge filter on two
video streams where the audio may be missing for an unknown period of time
on the second stream. To use slightly more concrete terms, I have a simple
example:

* Two videos of the same length, same encoding, same audio sampling rates.
* Using ashowinfo and inspecting the first packet the difference becomes
apparent:

===First video===
ffmpeg -i a_re.webm -af 'ashowinfo' -f null /dev/null
...
[Parsed_ashowinfo_0 @ 0x7fe7f8c19de0] n:0 pts:79584 pts_time:1.658 pos:7827
fmt:fltp channels:1 chlayout:mono rate:48000 nb_samples:960
checksum:DE7F2A43 plane_checksums: [ DE7F2A43 ]
[Parsed_ashowinfo_0 @ 0x7fe7f8c19de0] n:1 pts:80544 pts_time:1.678 pos:7902
fmt:fltp channels:1 chlayout:mono rate:48000 nb_samples:960
checksum:15BE5F14 plane_checksums: [ 15BE5F14 ]
....

===Second video===
ffmpeg -i b_re.webm -af 'ashowinfo' -f null /dev/null
...
[Parsed_ashowinfo_0 @ 0x7f8711700000] n:0 pts:192 pts_time:0.004 pos:8537
fmt:fltp channels:1 chlayout:mono rate:48000 nb_samples:960
checksum:2E9F59AA plane_checksums: [ 2E9F59AA ]
[Parsed_ashowinfo_0 @ 0x7f8711700000] n:1 pts:1152 pts_time:0.024 pos:19246
fmt:fltp channels:1 chlayout:mono rate:48000 nb_samples:960
checksum:68193A05 plane_checksums: [ 68193A05 ]
....

The amerge takes each frame and merges them, one by one based on the
STARTPTS of input 0. I'm curious if there's any way to make this have an
offset for the audio in the videos to the STARTPTS for that respective
audio?

Best,
Ned

-- 
Ned Rockson


More information about the ffmpeg-user mailing list