As promised in a previous thread, here is the first draft of my iPod encoding guide. As usual, feel free to tell me when I am talking out of my ass. -- Cheers, -Mark
Oh hell, I found some stupid copy-and-paste errors. Just ignore draft 1 and let's all start the discussion with draft 2 (attached). -- Cheers, -Mark
Hi, On 1/12/07, Mark Pilgrim <pilgrim@gmail.com> wrote:
Oh hell, I found some stupid copy-and-paste errors. Just ignore draft 1 and let's all start the discussion with draft 2 (attached).
\o/ Excellent! \o/ Here is a few remarks: +<para> + The iPod 5G supports the H.264 baseline profile with a maximum size of + 320 x 240 and a maximum bitrate of 768kbps. The screen on the iPod 5G + is exactly 320 x 240, so this works out well for source material with a + 4x3 aspect ratio. For widescreen source material, you can choose to crop + the video horizontally or scale the video down to 320 x (some number smaller + than 240). The iPod 5G will correctly display widescreen videos by + centering them vertically within the iPod screen; there is no need to add + black bars to the encoded video file itself.</para> The specs I found here (http://www.apple.com/ipod/specs.html) do not seem to corroborate your findings: Video formats supported: H.264 video, up to 1.5 Mbps, 640 by 480 pixels, 30 frames per sec., Low-Complexity version of the H.264 Baseline Profile with AAC-LC audio up to 160 Kbps, 48 kHz, stereo audio in .m4v, .mp4, and .mov file formats; H.264 video, up to 768 Kbps, 320 by 240 pixels, 30 frames per sec., Baseline Profile up to Level 1.3 with AAC-LC audio up to 160 Kbps, 48 kHz, stereo audio in .m4v, .mp4, and .mov file formats; MPEG-4 video, up to 2.5 Mbps, 640 by 480 pixels, 30 frames per sec., Simple Profile with AAC-LC audio up to 160 Kbps, 48 kHz, stereo audio in .m4v, .mp4, and .mov file formats Well, maybe it's due to the fact that these are the iPod's 5.5G's tech specs... But apparently, after some googling, it seems that both 5 and 5.5 G support the same video constrains. Could you test 1.5 Mbps, 640 by 480 pixels on your 5G? (Google tells me that the screen is 320 by 240 pixels, so 640 by 480 videos are just downscaled, which could seem like a waste of bits, unless you wanna create a video that can be both watchable on a computer, and on an ipod). What about 25fps videos? Are they supported too? +<para>The H.264 baseline profile imposes a number of constraints:</para> + +<itemizedlist> +<listitem><para> + <emphasis role="bold">B-frames</emphasis> are not supported. They are off + by default, so just skip them. This also means that + <option>b_pyramid</option> and <option>weight_b</option> will have no + effect. +</para></listitem> +<listitem><para> + <emphasis role="bold">8x8 DCT macroblocks</emphasis> are not supported. + This option (<option>8x8dct</option>) is off by default, so just be sure + not to explicitly enable it. This also means that the + <option>partitions=i8x8</option> option will have no effect, since it + requires <option>8x8dct</option>. +</para></listitem> +<listitem><para> + <emphasis role="bold">CABAC</emphasis> is not supported. You must + specifically turn it off with the <option>nocabac</option> option. +</para></listitem> +</itemizedlist> Although I don't like the fact that this looks very much alike "QT encoding guide", I guess it will probably help the user getting started if things are recapped here too. _maybe_ it could be worthwhile to add to x264's encoding section a note about the different h264 levels/profile. How do you feel about this? + If you have a multi-processor machine, you can add + <option>threads=auto</option>. This increases encoding speed by about + 94% per CPU core, with very little quality penalty (about 0.005dB for + dual processor, about 0.01dB for a quad processor machine). +</para> This should be moved to the x264's doc section about encoding options (same for QT encoding guide); actually x264's section needs a serious lifting, which I need to take care of over the weekend. +<para> + The second pass is the same, with <option>pass=2</option>, plus an output + filename, minus <option>turbo=1</option>. I don't have any strong opinion about this, but "turbo" should either always be on 2nd pass, or never (in that case, QT guide should be fixed). People seem to get easily confused about the real effect of turbo, so either way, there will always be ppl wondering if they should leave it on or drop it on 2nd pass. Thanks, Guillaume
On 1/12/07, Guillaume POIRIER <poirierg@gmail.com> wrote:
The specs I found here (http://www.apple.com/ipod/specs.html) do not seem to corroborate your findings:
Video formats supported: H.264 video, up to 1.5 Mbps, 640 by 480 pixels, 30 frames per sec., Low-Complexity version of the H.264 Baseline Profile with AAC-LC audio up to 160 Kbps, 48 kHz, stereo audio in .m4v, .mp4, and .mov file formats
OK, I did some digging and here's the deal with 640x480 video: yes, it's supported by the latest 1.2 firmware (even on the older 5G models, as long as they're running the latest 1.2 firmware). You need to specify idc_level=30 instead of 13, and -vf scale=640:-10 instead of 320:-10. References: http://forum.doom9.org/showpost.php?p=880331&postcount=74 http://forum.doom9.org/showpost.php?p=879940&postcount=65 BUT (and this is a big but), iTunes 7 will not copy any MP4 video larger than 320x240 to the iPod unless the MP4 file contains a special "secret" UUID in a specific atom. References: http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2006-September/045391.html I have independently verified this claim with my own encodes. Tyler apparently hacked libavformat to produce iPod-compatible output when using the mp4 container. "Nic" on the doom9 forums hacked MP4Box to achieve the same result. Tyler has integrated his hack into his VisualHub product (Mac-only). "Nic" has released his hacked version of MP4Box as a standalone tool (Windows-only binary, but he published the source code too and marked his changes well). I believe Tyler's hack is also integrated into ffmpegX (Mac-only). References: http://forum.doom9.org/showpost.php?p=880122&postcount=66 Neither code hack is particularly good quality (each author admits this) and neither of them have made it upstream. This means that, while you *can* use non-Apple tools to create 640x480 video that plays on (or through) the iPod, you can't subsequently use Apple tools (i.e. iTunes) to sync such videos to your iPod, unless you use a hacked version of either libavformat or MP4Box to create an "iTunes-compatible" .mp4 file. I'm happy to document some or all of this (there doesn't appear to be a good summary of it anywhere, except perhaps this message itself when it hits the web archives), or I'm happy to leave the documentation as-is and say that it is focused on creating small videos optimized for viewing-on-iPod (as opposed to larger videos optimized for viewing-on-TV-through-iPod-dock-connector).
What about 25fps videos? Are they supported too?
Yes.
Although I don't like the fact that this looks very much alike "QT encoding guide", I guess it will probably help the user getting started if things are recapped here too. _maybe_ it could be worthwhile to add to x264's encoding section a note about the different h264 levels/profile. How do you feel about this?
I've lost track of the x264 refactoring you've done in the past week, but I think a mention of H.264 profiles would be worthwhile. Or just a link to http://en.wikipedia.org/wiki/H.264#Profiles Two other unrelated things (these will serve as public reminders to myself): - add an example of "mp4creator -list" output showing iPod-compatible dump of the muxed video - mention that the iPod has no support for multiple audio tracks (so don't bother) or 3GPP timed text captions (so don't bother) -- Cheers, -Mark
On Wed, Jan 17, 2007 at 03:24:26PM -0500, Mark Pilgrim wrote:
I'm happy to document some or all of this (there doesn't appear to be a good summary of it anywhere, except perhaps this message itself when it hits the web archives), or I'm happy to leave the documentation as-is and say that it is focused on creating small videos optimized for viewing-on-iPod (as opposed to larger videos optimized for viewing-on-TV-through-iPod-dock-connector).
I'd say document. Diego
Hi, On 1/17/07, Mark Pilgrim <pilgrim@gmail.com> wrote: [..]
I'm happy to document some or all of this (there doesn't appear to be a good summary of it anywhere, except perhaps this message itself when it hits the web archives), or I'm happy to leave the documentation as-is and say that it is focused on creating small videos optimized for viewing-on-iPod (as opposed to larger videos optimized for viewing-on-TV-through-iPod-dock-connector).
IMHO, it's ok give a brief overview of what's the deal with 640x480 videos on iPod, and to put a link to this discution in the docs. You could write smth along the lines of: All 5G+ iPod support 640x480 at 1.5MB/s videos too, with the same subset of H.264 features as 320x240 videos, except for [place here a brief talk about the special "secret" UUID in a specific atom, show that support for them is currently very hackish] This guide will mainly focus on creating 320x240 videos, but most steps are equivalent for higher resultion videos (up to 640x480). The reason I'm reluctant to document smth that requires hacks is that I don't like the idea of "setting in stone" directions that are very clumsy when, possibly, the day after I commit the doc patch, either 3rd party tools begin to support setting iPod UUIDs, or iTunes 8 ships and stops checking for that stupid UUID. I hope you see what I mean... [..]
I've lost track of the x264 refactoring you've done in the past week, but I think a mention of H.264 profiles would be worthwhile. Or just a link to http://en.wikipedia.org/wiki/H.264#Profiles
You can have an overview here: http://svn.mplayerhq.hu/mplayer/trunk/DOCS/xml/en/encoding-guide.xml?view=lo... Basicly: Fixed some encoding option names (you were using the old ones) (doesn't affect you, but please check that the options you're suggesting in your patch are the new option names) Fixed a typo in lavc section (doesn't affect you at all) update x264's subq otion description (doesn't affect you) update and factorize information about x264's multi-threading mode (this affects you. You can link to the paragraph that discusses x264's multi-threaded mode by using linkend="menc-feat-x264-encoding-options-speedvquality-threads"> You can see the changes here (note that I already updated QT's encoding guide): http://svn.mplayerhq.hu/mplayer/trunk/DOCS/xml/en/encoding-guide.xml?r1=21931&r2=21932 Other changes are just typo/wording/style fixes, that do not really affect you either. Guillaume
On Thu, Jan 11, 2007 at 07:22:27PM -0500, Mark Pilgrim wrote:
Oh hell, I found some stupid copy-and-paste errors. Just ignore draft 1 and let's all start the discussion with draft 2 (attached).
Guillaume already gave you some constructive feedback, here are a few more formalities.
--- mplayer/DOCS/xml/en/encoding-guide.xml (revision 21881) +++ mplayer/DOCS/xml/en/encoding-guide.xml (working copy) @@ -4395,6 +4395,264 @@ + The first video-capable iPod was introduced in 2005 and dubbed the "5G" or + "fifth-generation" iPod. This guide will focus on the requirements of the + iPod 5G. Later iPod models may have different limitations.
Please use European-style single spaces after periods.
+ The iPod 5G supports the H.264 baseline profile with a maximum size of + 320 x 240 and a maximum bitrate of 768kbps.
Throughout the documentation we write sizes as AAAxBBB with no spaces in between, please stick to this for consistency.
+ <emphasis role="bold">Maximum bitrate</emphasis>: the iPod 5G supports a
Please capitalize complete sentences after a colon.
+ <application>MPlayer</application>, but of course the iPod 5G can not play
cannot Nit: There is some trailing whitespace, get rid of that. Diego
Hi On Thu, Jan 11, 2007 at 07:22:27PM -0500, Mark Pilgrim wrote:
Oh hell, I found some stupid copy-and-paste errors. Just ignore draft 1 and let's all start the discussion with draft 2 (attached).
-- Cheers, -Mark
[...]
+<para> + The iPod 5G supports two video formats: MPEG-4 ASP (such as DivX or Xvid)
do we have to mention 2 random mpeg4 implemenattions here?
+ and MPEG-4 AVC (commonly called H.264). It supports two audio formats: + MP3 and AAC. But it only support one container format: MP4. This guide + will explain how to create iPod-compatible files with H.264 video and AAC + audio in an MP4 container. <application>MEncoder</application> can not + create iPod-compatible MP4 files directly, but you can use + <application>MEncoder</application> to create the video and audio, and then + use an external program such as <application>mp4creator</application> to + remux into an MP4 container.</para>
this is not true, i do have a ipod and mencoder can with lavf generate working .mp4 files, so please remove this nonsense and use mencoder with lavf, if it doesnt work send a bugreport and ill fix it [...]
+<itemizedlist> +<listitem><para> + <emphasis role="bold">Maximum bitrate</emphasis>: the iPod 5G supports a + maximum of 768kbps, and it enforces this limit very strictly. This means + the bitrate can <emphasis>never</emphasis> exceed 768kbps. + <application>MEncoder</application> can enforce this restriction with + <option>-x264encopts vbv_maxrate=768</option>. The + <option>vbv_maxrate</option> option requires the presence of a + <option>vbv_bufsize</option> parameter; <option>vbv_bufsize=244</option> + is a good default value.
iam not so sure about these, sadly i didnt encode anything for the ipod lately but somehow i think i had much higher bitrates working [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB There will always be a question for which you do not know the correct awnser.
Hi, On 2/7/07, Michael Niedermayer <michaelni@gmx.at> wrote:
Hi
On Thu, Jan 11, 2007 at 07:22:27PM -0500, Mark Pilgrim wrote:
Oh hell, I found some stupid copy-and-paste errors. Just ignore draft 1 and let's all start the discussion with draft 2 (attached).
-- Cheers, -Mark
[...]
+<para> + The iPod 5G supports two video formats: MPEG-4 ASP (such as DivX or Xvid)
do we have to mention 2 random mpeg4 implemenattions here?
;-)
+ and MPEG-4 AVC (commonly called H.264). It supports two audio formats: + MP3 and AAC. But it only support one container format: MP4. This guide + will explain how to create iPod-compatible files with H.264 video and AAC + audio in an MP4 container. <application>MEncoder</application> can not + create iPod-compatible MP4 files directly, but you can use + <application>MEncoder</application> to create the video and audio, and then + use an external program such as <application>mp4creator</application> to + remux into an MP4 container.</para>
this is not true, i do have a ipod and mencoder can with lavf generate working .mp4 files, so please remove this nonsense and use mencoder with lavf, if it doesnt work send a bugreport and ill fix it
Did you save the commandline you used to encode for iPod? Guillaume
Hi On Wed, Feb 07, 2007 at 10:54:50PM +0100, Guillaume POIRIER wrote:
Hi,
On 2/7/07, Michael Niedermayer <michaelni@gmx.at> wrote:
Hi
On Thu, Jan 11, 2007 at 07:22:27PM -0500, Mark Pilgrim wrote:
Oh hell, I found some stupid copy-and-paste errors. Just ignore draft 1 and let's all start the discussion with draft 2 (attached).
-- Cheers, -Mark
[...]
+<para> + The iPod 5G supports two video formats: MPEG-4 ASP (such as DivX or Xvid)
do we have to mention 2 random mpeg4 implemenattions here?
;-)
+ and MPEG-4 AVC (commonly called H.264). It supports two audio formats: + MP3 and AAC. But it only support one container format: MP4. This guide + will explain how to create iPod-compatible files with H.264 video and AAC + audio in an MP4 container. <application>MEncoder</application> can not + create iPod-compatible MP4 files directly, but you can use + <application>MEncoder</application> to create the video and audio, and then + use an external program such as <application>mp4creator</application> to + remux into an MP4 container.</para>
this is not true, i do have a ipod and mencoder can with lavf generate working .mp4 files, so please remove this nonsense and use mencoder with lavf, if it doesnt work send a bugreport and ill fix it
Did you save the commandline you used to encode for iPod?
no, but heres a new working one mencoder somevideo.avi -ovc lavc -oac lavc -lavcopts vcodec=mpeg4:v4mv:mbd=2:trell:aic=2:cmp=2:subcmp=2:acodec=aac:vglobal=1:aglobal=1:vbitrate=1000:abitrate=128 -vf scale=320:180 -of lavf -lavfopts i_certify_that_my_video_stream_does_not_use_b_frames -info name=menctest -o menctest.mp4 the resolution can be increased upto 320x240, lame and x264 should work too some options are just for quality (v4mv, trell, ...) they can of course be ommited audio sampling rate was 48khz in my test case fps was 24000/1001 in my case and AV sync was correct [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I have never wished to cater to the crowd; for what I know they do not approve, and what they approve I do not know. -- Epicurus
Hi On Sat, Feb 10, 2007 at 09:16:43PM +0100, Michael Niedermayer wrote:
Hi
On Wed, Feb 07, 2007 at 10:54:50PM +0100, Guillaume POIRIER wrote:
Hi,
On 2/7/07, Michael Niedermayer <michaelni@gmx.at> wrote:
Hi
On Thu, Jan 11, 2007 at 07:22:27PM -0500, Mark Pilgrim wrote:
Oh hell, I found some stupid copy-and-paste errors. Just ignore draft 1 and let's all start the discussion with draft 2 (attached).
-- Cheers, -Mark
[...]
+<para> + The iPod 5G supports two video formats: MPEG-4 ASP (such as DivX or Xvid)
do we have to mention 2 random mpeg4 implemenattions here?
;-)
+ and MPEG-4 AVC (commonly called H.264). It supports two audio formats: + MP3 and AAC. But it only support one container format: MP4. This guide + will explain how to create iPod-compatible files with H.264 video and AAC + audio in an MP4 container. <application>MEncoder</application> can not + create iPod-compatible MP4 files directly, but you can use + <application>MEncoder</application> to create the video and audio, and then + use an external program such as <application>mp4creator</application> to + remux into an MP4 container.</para>
this is not true, i do have a ipod and mencoder can with lavf generate working .mp4 files, so please remove this nonsense and use mencoder with lavf, if it doesnt work send a bugreport and ill fix it
Did you save the commandline you used to encode for iPod?
no, but heres a new working one
mencoder somevideo.avi -ovc lavc -oac lavc -lavcopts vcodec=mpeg4:v4mv:mbd=2:trell:aic=2:cmp=2:subcmp=2:acodec=aac:vglobal=1:aglobal=1:vbitrate=1000:abitrate=128 -vf scale=320:180 -of lavf -lavfopts i_certify_that_my_video_stream_does_not_use_b_frames -info name=menctest -o menctest.mp4
the resolution can be increased upto 320x240, lame and x264 should work too
actually this is wrong, iam repeating what these loonys say witout checking, sorry, ive checked and mpeg4 640x360 at 2mb/sec average bitrate works perfectly fine too that is without any weird special ipod tags at least i dont remember that any where ever added to lavf, note i didnt try higher resolutions or bitrates yet ... file was uploaded to ipod with gtkpod ... [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The educated differ from the uneducated as much as the living from the dead. -- Aristotle
On Wed, Feb 07, 2007 at 10:50:22PM +0100, Michael Niedermayer wrote:
+ The iPod 5G supports two video formats: MPEG-4 ASP (such as DivX or Xvid)
do we have to mention 2 random mpeg4 implemenattions here?
Most people have no idea what "mpeg-4" means (but they believe they know) so it probably helps to give examples. Most people who have heard of "DivX" also don't realize that it's not a distinct format. This guide helps clear up that confusion.
+ and MPEG-4 AVC (commonly called H.264). It supports two audio formats: + MP3 and AAC. But it only support one container format: MP4. This guide + will explain how to create iPod-compatible files with H.264 video and AAC + audio in an MP4 container. <application>MEncoder</application> can not + create iPod-compatible MP4 files directly, but you can use + <application>MEncoder</application> to create the video and audio, and then + use an external program such as <application>mp4creator</application> to + remux into an MP4 container.</para>
this is not true, i do have a ipod and mencoder can with lavf generate working .mp4 files, so please remove this nonsense and use mencoder with lavf, if it doesnt work send a bugreport and ill fix it
What about B-frames?
Hi, Jeff Clagg wrote:
On Wed, Feb 07, 2007 at 10:50:22PM +0100, Michael Niedermayer wrote:
+ and MPEG-4 AVC (commonly called H.264). It supports two audio formats: + MP3 and AAC. But it only support one container format: MP4. This guide + will explain how to create iPod-compatible files with H.264 video and AAC + audio in an MP4 container. <application>MEncoder</application> can not + create iPod-compatible MP4 files directly, but you can use + <application>MEncoder</application> to create the video and audio, and then + use an external program such as <application>mp4creator</application> to + remux into an MP4 container.</para>
this is not true, i do have a ipod and mencoder can with lavf generate working .mp4 files, so please remove this nonsense and use mencoder with lavf, if it doesnt work send a bugreport and ill fix it
What about B-frames?
This shouldn't matter. B-frames aren't supported on iPod. Here's what the patch has to say about this: + <emphasis role="bold">B-frames</emphasis> are not supported. They are off + by default, so just skip them. This also means that + <option>b_pyramid</option> and <option>weight_b</option> will have no + effect.
On 2/7/07, Michael Niedermayer <michaelni@gmx.at> wrote:
+ audio in an MP4 container. <application>MEncoder</application> can not + create iPod-compatible MP4 files directly, but you can use + <application>MEncoder</application> to create the video and audio, and then + use an external program such as <application>mp4creator</application> to + remux into an MP4 container.</para>
this is not true, i do have a ipod and mencoder can with lavf generate working .mp4 files, so please remove this nonsense and use mencoder with lavf, if it doesnt work send a bugreport and ill fix it
Does it work with iPod firmware 1.1? Because it didn't when firmware 1.1 came out. I can't recommend a method that only works for some iPods. -- Cheers, -Mark
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Mark Pilgrim wrote:
On 2/7/07, Michael Niedermayer <michaelni@gmx.at> wrote:
+ audio in an MP4 container. <application>MEncoder</application> can not + create iPod-compatible MP4 files directly, but you can use + <application>MEncoder</application> to create the video and audio, and then + use an external program such as <application>mp4creator</application> to + remux into an MP4 container.</para>
this is not true, i do have a ipod and mencoder can with lavf generate working .mp4 files, so please remove this nonsense and use mencoder with lavf, if it doesnt work send a bugreport and ill fix it
Does it work with iPod firmware 1.1? Because it didn't when firmware 1.1 came out. I can't recommend a method that only works for some iPods.
so, there is one more point in TODO file :) : + fix mp4 files for iPod 1.1 generator - -- *| Micha? Wi?niewski - brylozketrzyn<at>gmail<dot>com |* *| Registered Linux' User #434742 |* *| DS2 101D |* -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) Comment: Using GnuPG with Mandriva - http://enigmail.mozdev.org iD8DBQFFy51IcghaB+q06f0RAtfXAJ9nYJd4/yLxrHLtNqTuLtJhFxYUDwCdFFIG dKTgGC9Ee7DJUHRmqkogYmY= =x/TH -----END PGP SIGNATURE-----
Hi On Thu, Feb 08, 2007 at 04:21:21PM -0500, Mark Pilgrim wrote:
On 2/7/07, Michael Niedermayer <michaelni@gmx.at> wrote:
+ audio in an MP4 container. <application>MEncoder</application> can not + create iPod-compatible MP4 files directly, but you can use + <application>MEncoder</application> to create the video and audio, and then + use an external program such as <application>mp4creator</application> to + remux into an MP4 container.</para>
this is not true, i do have a ipod and mencoder can with lavf generate working .mp4 files, so please remove this nonsense and use mencoder with lavf, if it doesnt work send a bugreport and ill fix it
Does it work with iPod firmware 1.1? Because it didn't when firmware 1.1 came out. I can't recommend a method that only works for some iPods.
my ipod says version 1.1 in settings/about, dunno if thats the firmware or something else [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB It is dangerous to be right in matters on which the established authorities are wrong. -- Voltaire
participants (7)
-
Diego Biurrun -
Guillaume POIRIER -
Guillaume Poirier -
Jeff Clagg -
Mark Pilgrim -
Micha? Wis'niewski -
Michael Niedermayer