[FFmpeg-user] Compensating for missing audio frames at beginning of video
rwilliams at busivid.com
Thu Dec 10 08:11:23 CET 2015
I'm not sure if this will be of any help but look into the asetpts, adelay and amix filters.
You may also find that the afifo filter may help but be careful as it consumes large amounts of memory.
Failing that; perhaps you could generate a stream of silence with aevalsrc='0|0' then merge each stream with silence prior to merging them together.
This would at least give you two audio streams with samples commencing from 00:00:00.00
From: ffmpeg-user [mailto:ffmpeg-user-bounces at ffmpeg.org] On Behalf Of Ned Rockson
Sent: Thursday, 10 December 2015 07:06
To: ffmpeg-user at ffmpeg.org
Subject: [FFmpeg-user] Compensating for missing audio frames at beginning of video
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
* Two videos of the same length, same encoding, same audio sampling rates.
* Using ashowinfo and inspecting the first packet the difference becomes
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 ] ....
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?
ffmpeg-user mailing list
ffmpeg-user at ffmpeg.org
More information about the ffmpeg-user