#9513 closed defect (fixed)
shortest cuts audio off early on 1fps video
Reported by: | Cosmin Stejerean | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | ffmpeg |
Version: | git-master | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
This might be related to #9512 but the problem manifests itself differently and it's specific to low fps video, where it appears the audio cuts off as soon as the last frame is written rather than accounting for the last frame duration.
But similarly to #9512 it works differently on video copy vs video transcode.
Let's create the assets
% ffmpeg -f lavfi -i testsrc2=size=vga:rate=1 -t 10 -y video.mp4 % ffmpeg -f lavfi -i sine=1000 -t 30 -y music.m4a
Attempting a simple operation to edit the audio and leave the video alone, cutting audio off at the video duration
% ffmpeg -i music.m4a -i video.mp4 -filter_complex '[0:a:0] volume=1 [audio]' -map "[audio]" -map 1:v:0 -c:v libx264 -c:a libfdk_aac -shortest -y mixed-transcoded.mp4
This works, produces a 10s output and it plays correctly with audio through the end. But the video transcode is unnecessary given the video isn't being modified. Trying again with -c:v copy
% ffmpeg -i music.m4a -i video.mp4 -filter_complex '[0:a:0] volume=1 [audio]' -map "[audio]" -map 1:v:0 -c:v copy -c:a libfdk_aac -shortest -y mixed-copy.mp4
Based on a naive ffprobe inspection this appears correct with a total duration of 10s. But looking at the individual streams show that audio in fact is only 7s long (and attempting to play it cuts off audio early).
I originally assumed this was missing the last 1s due the frame duration, but the problem seems potentially worse as it's actually missing almost 3s of video
Change History (4)
comment:1 by , 2 years ago
comment:2 by , 2 years ago
Version: | unspecified → 4.2.4 |
---|
comment:3 by , 2 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Should be fixed in c1818cb9471c0ab8345a023dc16d6b0c8c2ee000
comment:4 by , 18 months ago
Component: | undetermined → ffmpeg |
---|---|
Version: | 4.2.4 → git-master |
I can confirm that I am seeing the same problem in ffmpeg version 4.2.4-1ubuntu0.1, .mp4 vcodec libx264, both using acodec aac and ac3. I do not have the problem when using .webm vcodec libvpx-vp9 and acodec libopus.
My application supplies frames from python using vidgear, encoding the video to 25fps.