I use ffmpeg to convert and join multiple mp3 files into m4a.

find . -name "*.mp3" | parallel --lb -k "ffmpeg -y -i {} -map 0:a -c:a aac -b:a $BITRATE {.}.m4a"

ffmpeg  -f concat -safe 0 -i <(find "$(pwd)" -name "*.m4a" -exec echo file \'{}\' \; | sort ) -c copy $OUT_NAME

Conversion goes without warnings but concatination gives a lot of this stuff:

[ipod @ 0x7fbc25016a00] Non-monotonous DTS in output stream 0:0; previous: 136561921, current: 136533787; changing to 136561922. This may result in incorrect timestamps in the output file.

I know that it's not an error and I probably can move along but those messages irritate me as a programmer. I made some experiments and came to conclusion that culprit is one of the input mp3 files. ffprobe warned me about it like that:

[mp3 @ 0x7f8c1d817000] Estimating duration from bitrate, this may be inaccurate

This leads me to questions: is this incorrect timestamping just being copied to output m4a file during conversion? Why this happens?

I've read somewhere that just copying mp3 stream with ffmpeg could fix incorrect duration recorded in mp3 file. So did some more experiments.

ffmpeg -i 01.mp3 -c:a copy 001.mp3

ffprobe gives no warning for this new file! So another question apears: how copying stream fixes mp3 file? OK I can do without this explanation, just would be nice to know. But MAIN QUESTION follows: If I'm going to stream copy EACH mp3 file into another ffmpeg process that will convert it to m4a how safe it is? Won't this create some unforseen issues for me, probably with corrupted files or some other things? Please enlighten me someone. Thanks in advance!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.