[FFmpeg-trac] #9228(avcodec:new): multiple output in single C/libavcodec xcode process offsets "start" in output files
FFmpeg
trac at avcodec.org
Sun May 9 23:08:31 EEST 2021
#9228: multiple output in single C/libavcodec xcode process offsets "start" in
output files
-------------------------------------+-------------------------------------
Reporter: Ray | Type: defect
Status: new | Priority: normal
Component: avcodec | Version: 4.2.4
Keywords: AAC | Blocked By:
transcoding |
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
-------------------------------------+-------------------------------------
Summary of the bug:
I have a C/libavcodec program that transcodes multiple input files to
resulting mp3 or m4a using the inbuilt ffmeg libmp3lame or aac encoders
respectively. No libavcodec constructs are reused (new AVCodecContext,
AVFormatContext, AVAudioFifo used for every transcode)
When generating .m4a output, examining the output using ffprobe, I observe
the "start" is incrementally offset. the first m4a file is at 00:00:00
but the subsequent m4a file has a "start" that is offset by a time very
close to the length of the first file. This does not happen when
transcoding to mp3.
I have been able to reproduce this using the examples/transcode_aac.c and
modified it so that it creates multiple files.
For example, when transcoding the same 5sec wav file to m4a within the
same process generates a set of files but the start time is offset further
and further as each new file is generated - note the "start" time
{{{
$ for i in /tmp/a/foo*m4a; do ffprobe -hide_banner -i $i; done
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/tmp/a/foo00.m4a':
Metadata:
major_brand : M4A
minor_version : 512
compatible_brands: isomiso2
encoder : Lavf58.29.100
Duration: 00:00:05.02, start: 0.000000, bitrate: 79 kb/s
Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz,
stereo, fltp, 76 kb/s (default)
Metadata:
handler_name : SoundHandler
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/tmp/a/foo01.m4a':
Metadata:
major_brand : M4A
minor_version : 512
compatible_brands: isomiso2
encoder : Lavf58.29.100
Duration: 00:00:05.02, start: 4.976009, bitrate: 79 kb/s
Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz,
stereo, fltp, 76 kb/s (default)
Metadata:
handler_name : SoundHandler
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/tmp/a/foo02.m4a':
Metadata:
major_brand : M4A
minor_version : 512
compatible_brands: isomiso2
encoder : Lavf58.29.100
Duration: 00:00:05.02, start: 9.976009, bitrate: 79 kb/s
Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz,
stereo, fltp, 76 kb/s (default)
Metadata:
handler_name : SoundHandler
}}}
I would expect ALL files to be identical. I tested this with built in aac
and also libfdk_aac and both exhibit this behaviour
How to reproduce:
{{{
# have a single process that will transocde mulitple files to aac within a
single process.
# see attached patched transcode_aac.c
$ ./transcode_aac input.wav output m4a 3
# generates 3x m4a encoded by inbuilt "aac" encoder called
output{00,01,02}.m4a
# examine the output files, observing the start time via ffprobe
}}}
Attached are the wav input, m4a outputs and the sameple src code that
demonstrates this - code is examples/doc/transcode_aac.c with a loop
around old main() function with a new output file name on next iteration.
--
Ticket URL: <https://trac.ffmpeg.org/ticket/9228>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list