[FFmpeg-user] Convert iPhone MOV to Android MP4

Cley Faye cleyfaye at gmail.com
Fri Mar 10 14:06:02 EET 2017


2017-03-10 7:14 GMT+01:00 Richard Duran <ricdur2 at gmail.com>:

> I will have to try that. I was about to revert back to my original
> question, wondering why going from AAC input to AAC output didn't retain
> the input bitrate.
>

​(all of the following is what I think, knowing how I use ffmpeg)​

B
​ecause​ it doesn't make much sense from ffmpeg's point of view to even
know the input codec settings when creating output.

First, some codec settings aren't necessarily present in the input anyway.
I don't know for AAC, but it's more obvious for video codec where a lot of
encoding tweaking isn't visible in the output metadata. Reusing what is
known (bitrate and samplerate) without all other settings would probably
produce something different, and might or might not be "the best way" to
retain the best quality from the source material.
Add to that that an "output" (from ffmpeg's point of view) might not even
come from anything: the output of a filterchain for example.

Second, and I guess this is more obvious, transcoding with lossy codec WILL
lose source data. Assuming all settings are equal, transcoding from a
100kbit/s AAC stream to a 100kbit/s AAC stream will lose some data from the
source. Even transcoding at a higher bitrate, you will lose something
(although it might not be noticeable the first few times you do it). That's
the nature of lossy compression (same thing apply to video codec, jpeg
images, etc.)

Third, ffmpeg can't tell your intent. Since, because of my first point, it
can't reuse the input settings, it does what seems to be the best next
choice: use sensible settings to keep good quality. This part is totally
subjective, and that's why we have so many settings. As far as I know, for
most codec, ffmpeg's default tends to be alright (I regularly transcode
video to x264 with no settings for quick previews, they come out ok). But
it can't tell if you want to keep the source data as much as possible, or
if you want to keep good quality (which will incur loss of data, but not
necessarily in a noticeable way), or if you want a quick transcode to test
something else.

​And finally, fourth, something I just thought while writting this: if you
want to transcode from AAC to AAC, with the same input settings, to keep
the same quality, it's not going to happen. Even if ffmpeg was modified to
retain the input codec settings automatically, and had all these
informations at the end, as long as you ask for a transcode it will do it,
meaning recompressing the input. You *really* want to use the copy method
here.

Writting a small script that take input files, probe them using ffprobe,
then create ffmpeg command with either "-c copy" or appropriate aac
settings seems to be the cleanest way you could achieve what you're asking.


More information about the ffmpeg-user mailing list