Re: [FFmpeg-user] Convert iPhone MOV to Android MP4
On Mar 8, 2017 3:22 PM, "Cley Faye" <cleyfaye@gmail.com> wrote: 2017-03-08 23:06 GMT+01:00 Richard Duran <ricdur2@gmail.com>:
Example #2, input with pcm_s16le, input bitrate of 705 kb/s. Output
defaults to 69 kb/s. I would have expected the output bitrate to match
bitrate that
of the input. Does AAC support that high of a bitrate?
What are you trying to do and to what end? Matching the bitrates between pcm (uncompressed) and AAC (lossy compression) doesn't make much sense. Ah! That distinction didn't even occur to me. To answer your question: I'm trying to retain as much of the source data as possible in moving video from an iPhone to an Android-based phone. I'll try my luck with ALAC instead of AAC. Thanks for the input.
On Wed, 8 Mar 2017 17:04:18 -0700 Richard Duran <ricdur2@gmail.com> wrote:
I'll try my luck with ALAC instead of AAC.
I doubt you can mux ALAC into MP4. If you must use MP4 then encode PCM inputs to AAC and stream copy AAC inputs. You can use ffprobe to determine the input audio format which is useful if you want to script it: $ ffprobe -loglevel error -select_streams a:0 -show_entries stream=codec_name -of csv=p=0 input.mov Then use ffmpeg: ffmpeg -i input -c copy -c:a aac output.mp4 or ffmpeg -i input -c copy output.mp4
On Wed, Mar 8, 2017 at 5:29 PM, Lou <lou@lrcd.com> wrote:
On Wed, 8 Mar 2017 17:04:18 -0700 Richard Duran <ricdur2@gmail.com> wrote:
I'll try my luck with ALAC instead of AAC.
I doubt you can mux ALAC into MP4.
Good point on that. I suppose my choice for MP4 output was somewhat arbitrary. I was just looking at it as the default format used on Android. I'll look into other formats that are compatible with PCM audio and natively supported (read: don't require VLC to be installed). Thanks to all who've responded.
On Thu, Mar 09, 2017 at 09:43:36 -0700, Richard Duran wrote:
Good point on that. I suppose my choice for MP4 output was somewhat arbitrary. I was just looking at it as the default format used on Android. I'll look into other formats that are compatible with PCM audio and natively supported (read: don't require VLC to be installed).
A quick check found this: https://developer.android.com/guide/topics/media/media-formats.html#audio-fo... which seems to indicate that, on Android, the only format which can carry PCM audio is WAV. The only other supported lossless audio codec seems to be FLAC, but that is only supported in actual FLAC files. So it looks like you need to use a lossy codec. Moritz
On Thu, Mar 9, 2017 at 9:53 AM, Moritz Barsnick <barsnick@gmx.net> wrote:
A quick check found this: https://developer.android.com/guide/topics/media/media- formats.html#audio-formats which seems to indicate that, on Android, the only format which can carry PCM audio is WAV. The only other supported lossless audio codec seems to be FLAC, but that is only supported in actual FLAC files. So it looks like you need to use a lossy codec.
Cool. Thanks for the research.
Not a big deal to use a lossy codec. My primary goal was to be able to play the videos natively. Retaining as much of the source data as possible was a secondary goal.
My primary goal was to be able to play the videos natively. Retaining as much of the source data as possible was a secondary goal.
Hi, In your secondary goal, You could use max quality for aac encoder. -q:a 2 or a high bitrate -b:a 320k -- Isaías Hernández "Todo lo que baja... tiene que ¡subir!"
On Mar 9, 2017 12:07 PM, "Isaías Hernández Hernández" <chay1288@gmail.com> wrote:
My primary goal was to be able to play the videos natively. Retaining as much of the source data as possible was a secondary goal.
Hi, In your secondary goal, You could use max quality for aac encoder. -q:a 2 or a high bitrate -b:a 320k 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. I'm curious if your suggestion would force a lower input bitrate to a higher output bitrate.
2017-03-10 7:14 GMT+01:00 Richard Duran <ricdur2@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.
On Mar 10, 2017 5:14 AM, "Cley Faye" <cleyfaye@gmail.com> wrote: 2017-03-10 7:14 GMT+01:00 Richard Duran <ricdur2@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.
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. Thank you for clearing up some things for me, and especially for the explanation regarding what ffmpeg does and doesn't do. I am thinking that I will end up doing exactly as you and another responder suggested and make use of ffprobe.
On Fri, Mar 10, 2017 at 12:14 AM, Richard Duran <ricdur2@gmail.com> wrote:
I will have to try that. I was about to revert back to my original question, wwhy going from AAC input to AAC output didn't retain the input bitrate.
I'm curious if your suggestion would force a lower input bitrate to a higher output bitrate.
because ffmpeg by default transcode, in AAC target is 64 kbps in mono and 128kbps in stereo. If you want retain same quality you should use -acodec copy. -- Isaías Hernández "Todo lo que baja... tiene que ¡subir!"
Le nonidi 19 ventôse, an CCXXV, Richard Duran a écrit :
Not a big deal to use a lossy codec. My primary goal was to be able to play the videos natively.
The, may I ask, why do you want MP? Most versions of Android support Matroska, AFAIK.
Not a big deal to use a lossy codec. My primary goal was to be able to
On Mar 9, 2017 1:20 PM, "Nicolas George" <george@nsup.org> wrote: Le nonidi 19 ventôse, an CCXXV, Richard Duran a écrit : play
the videos natively.
The, may I ask, why do you want MP? Most versions of Android support Matroska, AFAIK. To be perfectly honest, I wasn't not familiar with what Android core supports natively. I based it off the fact that I knew that Android video capture uses MP4, and because I had read that MP4 and MOV containers supported the same codecs. The latter convinced me that I could keep the source streams intact, and would only need to change the container. Obviously, what I read was not entirely accurate. I will try both this and the previous suggestion. Yours should allow me to use the Opus codec.
Am 10.03.2017 um 07:21 schrieb Richard Duran:
On Mar 9, 2017 1:20 PM, "Nicolas George" <george@nsup.org> wrote:
Not a big deal to use a lossy codec. My primary goal was to be able to
Le nonidi 19 ventôse, an CCXXV, Richard Duran a écrit : play
the videos natively.
The, may I ask, why do you want MP? Most versions of Android support Matroska, AFAIK.
To be perfectly honest, I wasn't not familiar with what Android core supports natively. I based it off the fact that I knew that Android video capture uses MP4, and because I had read that MP4 and MOV containers supported the same codecs. The latter convinced me that I could keep the source streams intact, and would only need to change the container.
Obviously, what I read was not entirely accurate.
I will try both this and the previous suggestion. Yours should allow me to use the Opus codec
proper H264 (baseline) with AAC audio is supported by any device on this planet, there is even '-f ipod' and so honestly why not just use a format from the start which can be played everywhere?
On Mar 10, 2017 4:42 AM, "Reindl Harald" <h.reindl@thelounge.net> wrote: proper H264 (baseline) with AAC audio is supported by any device on this planet, there is even '-f ipod' and so honestly why not just use a format from the start which can be played everywhere? Because universal portability was not my primary goal. That said, this has been a learning experience for me with regards to codes as well as video containers.
Le nonidi 19 ventôse, an CCXXV, Richard Duran a écrit :
I will try both this and the previous suggestion. Yours should allow me to use the Opus codec.
Indeed, Matroska can support Opus, which is far better than anything else available at this time. Be warned, though, that not all versions of Android do support it, unfortunately. It may be supported at application level though. I strongly suspect that any FFmpeg-based application, starting with VLC, will. I do not know if applications can provide codec plugins for other applications. Regards, -- Nicolas George
On Mar 10, 2017 12:05 PM, "Nicolas George" <george@nsup.org> wrote: Le nonidi 19 ventôse, an CCXXV, Richard Duran a écrit :
I will try both this and the previous suggestion. Yours should allow me to use the Opus codec.
Indeed, Matroska can support Opus, which is far better than anything else available at this time. Be warned, though, that not all versions of Android do support it, unfortunately. It may be supported at application level though. I strongly suspect that any FFmpeg-based application, starting with VLC, will. I do not know if applications can provide codec plugins for other applications. I my small test cases, the native Android media player did, in fact, support Opus. Unfortunately, for me, the videos with rapid movement displayed some pixellization effects that I would prefer to avoid. I think I'm more willing to sacrifice audio than video, so I will probably be sticking to MP4 so I can use -vcopy. Again, thanks to all.
Le primidi 21 ventôse, an CCXXV, Richard Duran a écrit :
I think I'm more willing to sacrifice audio than video, so I will probably be sticking to MP4 so I can use -vcopy.
This sentence is based on a wrong assumption: you can use -c:v copy when remuxing to Matroska. And -c:a copy too, for that matter. Regards, -- Nicolas George
Please remove my mail from this discussion. Inviato da iPhone
Il giorno 09 mar 2017, alle ore 01:04, Richard Duran <ricdur2@gmail.com> ha scritto:
On Mar 8, 2017 3:22 PM, "Cley Faye" <cleyfaye@gmail.com> wrote:
2017-03-08 23:06 GMT+01:00 Richard Duran <ricdur2@gmail.com>:
Example #2, input with pcm_s16le, input bitrate of 705 kb/s. Output
defaults to 69 kb/s. I would have expected the output bitrate to match
bitrate that
of the input. Does AAC support that high of a bitrate?
What are you trying to do and to what end? Matching the bitrates between pcm (uncompressed) and AAC (lossy compression) doesn't make much sense.
Ah! That distinction didn't even occur to me. To answer your question: I'm trying to retain as much of the source data as possible in moving video from an iPhone to an Android-based phone.
I'll try my luck with ALAC instead of AAC.
Thanks for the input. _______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user
To unsubscribe, visit link above, or email ffmpeg-user-request@ffmpeg.org with subject "unsubscribe".
Am 09.03.2017 um 07:41 schrieb Michele Monteferrante:
Please remove my mail from this discussion.
read the f**g list-footer and next time before subscribe to a mailing-list try to understand what a amiling-list is how it works, and why there are welcome messages and list footers with instrcutions AT THE BITTOM OF EVERY MESSAGE AND YOU QUOTED IT TWO TIMES WITH YOUR MAIL: ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-request@ffmpeg.org with subject "unsubscribe".
Inviato da iPhone
Il giorno 09 mar 2017, alle ore 01:04, Richard Duran <ricdur2@gmail.com> ha scritto:
On Mar 8, 2017 3:22 PM, "Cley Faye" <cleyfaye@gmail.com> wrote:
2017-03-08 23:06 GMT+01:00 Richard Duran <ricdur2@gmail.com>:
Example #2, input with pcm_s16le, input bitrate of 705 kb/s. Output
defaults to 69 kb/s. I would have expected the output bitrate to match
bitrate that
of the input. Does AAC support that high of a bitrate?
What are you trying to do and to what end? Matching the bitrates between pcm (uncompressed) and AAC (lossy compression) doesn't make much sense.
Ah! That distinction didn't even occur to me. To answer your question: I'm trying to retain as much of the source data as possible in moving video from an iPhone to an Android-based phone.
I'll try my luck with ALAC instead of AAC.
Thanks for the input. _______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user
To unsubscribe, visit link above, or email ffmpeg-user-request@ffmpeg.org with subject "unsubscribe".
ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user
To unsubscribe, visit link above, or email ffmpeg-user-request@ffmpeg.org with subject "unsubscribe".
participants (8)
-
Cley Faye -
Isaías Hernández Hernández -
Lou -
Michele Monteferrante -
Moritz Barsnick -
Nicolas George -
Reindl Harald -
Richard Duran