[FFmpeg-trac] #9513(undetermined:new): shortest cuts audio off early on 1fps video
FFmpeg
trac at avcodec.org
Tue Nov 16 22:05:15 EET 2021
#9513: shortest cuts audio off early on 1fps video
-------------------------------------+-------------------------------------
Reporter: Cosmin | Type: defect
Stejerean |
Status: new | Priority: normal
Component: | Version:
undetermined | unspecified
Keywords: | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
-------------------------------------+-------------------------------------
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
--
Ticket URL: <https://trac.ffmpeg.org/ticket/9513>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list