Log in

View Full Version : "Magic" H.264 settings for iPod


benwaggoner
2nd September 2008, 19:55
I'm trying to figure out how to make iPod-compatible content from 3rd party encoders. Does anyone know what the actual magic parameters are for it?

Apple's official description is:

http://www.apple.com/ipodclassic/specs.html

H.264 video, up to 1.5 Mbps, 640 by 480 pixels, 30 frames per second, Low-Complexity version of the H.264 Baseline Profile with AAC-LC audio up to 160 Kbps, 48kHz, stereo audio in .m4v, .mp4, and .mov file formats; H.264 video, up to 2.5 Mbps, 640 by 480 pixels, 30 frames per second, Baseline Profile up to Level 3.0 with AAC-LC audio up to 160 Kbps, 48kHz, stereo audio in .m4v, .mp4, and .mov file formats; MPEG-4 video, up to 2.5 Mbps, 640 by 480 pixels, 30 frames per second, Simple Profile with AAC-LC audio up to 160 Kbps, 48kHz, stereo audio in .m4v, .mp4, and .mov file formats

So far so good, but what's this "Low-Complexity verison of the H.264 Baseline Profile?" Given Apple's encoder, I assume this at least means no reference frames. Anything else?

Sharktooth
2nd September 2008, 19:58
baseline with 1 ref, no partitions (taken from the megui presets).

Dark Shikari
2nd September 2008, 20:34
baseline with 1 ref, no partitions.Are you sure no partitions? I'm pretty sure this isn't the case... especially since its physically impossible to make x264 actually not use any partitions without modifying the code ;)

AFAIK its just Baseline with 1 ref.

Snowknight26
3rd September 2008, 00:10
Are you sure no partitions? I'm pretty sure this isn't the case... especially since its physically impossible to make x264 actually not use any partitions without modifying the code ;)

Don't forget about lossless mode.

Dark Shikari
3rd September 2008, 00:16
Don't forget about lossless mode.How is lossless related?

Theliel
3rd September 2008, 00:38
My iPod Touch profile:

Resolution: PAL, Up to 720*560
Bitrate: Level 3.0 -> up to 10Mb/s, and yes, work fine
Profile: Baseline ->

-All partitions: p8x8,b8x8,i4x4,p4x4
-5 ref frames, and yes, work perfectly with 5-6 ref :), and mix frames work fine too. The max ref frames ipod Acept are 6.
-No b-frames
-Deblocking, i like to use -2 -1
-ME tesa for me and RDO level 2

Yes, iPod Touch are not iPod Classic, but its very possible that the features will be the same. You can try ;)

Dark Shikari
3rd September 2008, 00:50
My iPod Touch profile:

Resolution: PAL, Up to 720*560
Bitrate: Level 3.0 -> up to 10Mb/s, and yes, work fine
Profile: Baseline ->

-All partitions: p8x8,b8x8,i4x4,p4x4
-5 ref frames, and yes, work perfectly with 5-6 ref :), and mix frames work fine too. The max ref frames ipod Acept are 6.
-No b-frames
-Deblocking, i like to use -2 -1
-ME tesa for me and RDO level 2

Yes, iPod Touch are not iPod Classic, but its very possible that the features will be the same. You can try ;)iPod Classic supports Level 1.3 only, not 3.0.

Ranguvar
3rd September 2008, 01:00
IIRC, the iPod Classic supports L1.3 at up to 768kb/s, and L3.0 at up to 1.5mb/s. Why the separation? A 320x240 video won't work at higher than 768kb/s... but a 640x480 video will. Don't ask.

Then there's all sorts of other funkiness, like whether the max bitrate is audio and video combined, why some videos just won't work, why some odd high resolutions work but others don't, only at particular bitrates, or how replacing the MP4 after it's been synced with iTunes sometimes works for non-syncing files... etc... I gave up on iPod encoding a LONG time ago. It's just not worth it :p

Sharktooth
3rd September 2008, 02:16
Are you sure no partitions? I'm pretty sure this isn't the case... especially since its physically impossible to make x264 actually not use any partitions without modifying the code ;)

AFAIK its just Baseline with 1 ref.
well, no partitions specified in the x264 commandline. however i didnt made the ipod preset for megui so it's possible all partitions are supported at both level 1.3 and 3.0 and i didnt know about it.
can anyone confirm? so i will alter the presets...

Sagittaire
3rd September 2008, 06:53
Well Mainconcept/Elecard say that for Portable - Apple iPod 55G:

Baseline, level 3.0, no cabac, no bframe, max at 2500 Kbps, no 8x8 partitions, no wpred, no CQM ...

<Parameter Name="Preset" GUID="{0D6239BD-E7DC-4DDB-AB8D-C21E8AFDA71C}" Type="VT_BSTR" Value="Apple iPOD"/>
<Parameter Name="Format" GUID="{F8A1E96D-A489-4EC1-9418-8B7D048364EF}" Type="VT_BSTR" Value="Auto"/>
<Parameter Name="Profile" GUID="{FDD66DC1-DB28-4DF9-ADE8-1FAD172FF045}" Type="VT_BSTR" Value="Baseline profile"/>
<Parameter Name="Level" GUID="{68AB7A6D-A427-467B-B39D-6651E50C22C4}" Type="VT_BSTR" Value="Level 3"/>
<Parameter Name="[Picture] Coding mode" GUID="{7CD6EF75-4420-4B77-BC22-4158B3F98956}" Type="VT_BSTR" Value="Frame"/>
<Parameter Name="[Picture] Field order" GUID="{749C8599-F66A-4161-B640-9B8B75D62EBD}" Type="VT_BSTR" Value="Top Field First"/>
<Parameter Name="[Picture] Slice count" GUID="{F519F267-3B17-481F-9F35-43CCA48FD098}" Type="VT_INT" Value="1"/>
<Parameter Name="[Picture] Pulldown mode" GUID="{6DFB21B7-9F43-4CCB-81BF-5723B10E0533}" Type="VT_BSTR" Value="Auto mode"/>
<Parameter Name="[GOP] Max length" GUID="{72EE0B12-AF81-41C4-AAE9-BFB23725F554}" Type="VT_INT" Value="120"/>
<Parameter Name="[GOP] Max B-frames" GUID="{3ADA1696-B94D-4D7E-B7BF-253D1103E835}" Type="VT_INT" Value="0"/>
<Parameter Name="[GOP] IDR frequency" GUID="{EECB285C-BDE6-4DA5-9A9E-4C366BCACD94}" Type="VT_INT" Value="1"/>
<Parameter Name="[GOP] Minimum length" GUID="{9EAFCA29-42F3-4CA5-B40C-6B87B2AD4483}" Type="VT_INT" Value="1"/>
<Parameter Name="[GOP] Use B-frame as reference" GUID="{90E40368-D85C-4139-8540-82A58C12B4C8}" Type="VT_BSTR" Value="No"/>
<Parameter Name="[GOP] Enable pyramid coding" GUID="{A3A30C66-9B00-44B0-827E-ABBC3BB0E4F4}" Type="VT_BSTR" Value="No"/>
<Parameter Name="[GOP] Enable adaptive GOP" GUID="{956A704B-00FC-436C-921E-BC6158955A82}" Type="VT_BSTR" Value="No"/>
<Parameter Name="[GOP] Scene change detector" GUID="{CBFC3E4B-4E06-4CE1-9088-866CC96433FE}" Type="VT_BSTR" Value="On"/>
<Parameter Name="[Rate] Fixed input frame rate" GUID="{ACAC1419-D3D0-47FF-AC9F-889B1D143981}" Type="VT_BSTR" Value="No"/>
<Parameter Name="[Rate] Input frame rate" GUID="{3F3F4E8F-07BA-4A0D-86B7-FA79907B373E}" Type="VT_R8" Value="25.000000"/>
<Parameter Name="[Rate] Fixed output frame rate" GUID="{0CD0C8F4-2AE6-4C2C-A8A7-99967F2E12F2}" Type="VT_BSTR" Value="No"/>
<Parameter Name="[Rate] Output frame rate" GUID="{8F8A8859-A4C2-46C5-8043-18DA54F7034E}" Type="VT_R8" Value="25.000000"/>
<Parameter Name="[RC] Bitrate mode" GUID="{CD701824-5F65-4520-8DB0-26548212808C}" Type="VT_BSTR" Value="Variable Bitrate"/>
<Parameter Name="[RC] Quantizer for I-slice" GUID="{F630A138-8661-4E3A-BF03-955F973AB110}" Type="VT_INT" Value="24"/>
<Parameter Name="[RC] Quantizer for P-slice" GUID="{10E2FDCC-1FB5-4CBC-BB5E-75567AB39F69}" Type="VT_INT" Value="25"/>
<Parameter Name="[RC] Quantizer for B-slice" GUID="{901DA7FD-F639-493F-8AD0-9492AEA72E1F}" Type="VT_INT" Value="27"/>
<Parameter Name="[RC] Cb chroma qp offset" GUID="{7EAD13ED-47B2-4030-8C14-1BAB66A02BA3}" Type="VT_INT" Value="1"/>
<Parameter Name="[RC] Cr chroma qp offset" GUID="{B4B009D0-E793-43E9-95A5-6D5D5C86E093}" Type="VT_INT" Value="1"/>
<Parameter Name="[RC] Average bitrate" GUID="{BDD50372-38E2-4A26-BA15-482B70EE136C}" Type="VT_INT" Value="920000"/>
<Parameter Name="[RC] Maximum bitrate" GUID="{51EB9A74-B317-4FBB-832B-CA5C2DAA193F}" Type="VT_INT" Value="2400000"/>
<Parameter Name="[RC] CPB size (bits)" GUID="{76B17FDA-A1DA-45A3-B50E-4A2A2B35D108}" Type="VT_INT" Value="8000000"/>
<Parameter Name="[RC] Initial CPB buffer fullness (90 kHz)" GUID="{770776A5-76AF-4AA7-A7DA-CCB700945ABE}" Type="VT_INT" Value="67500"/>
<Parameter Name="[RC] Final CPB buffer fullness (90 kHz)" GUID="{B419761A-839F-4DF7-85F8-E0FB2CC5D81F}" Type="VT_INT" Value="0"/>
<Parameter Name="[RC] Pass mode" GUID="{9078A811-26BC-4BA0-8AE7-6FC1CCF7D6D1}" Type="VT_BSTR" Value="Multi-Pass Analyse"/>
<Parameter Name="[RC] Statistics" GUID="{05E339D3-C15D-4928-A5B7-E5D165ACD7F1}" Type="VT_BSTR" Value=""/>
<Parameter Name="[RC] Adaptive quantization mode" GUID="{1D36FF32-0AA7-497E-94C6-EAC2BBCE23AD}" Type="VT_INT" Value="0"/>
<Parameter Name="[RC] Adaptive quantization strength" GUID="{FD316019-B4C8-4947-A1CF-49D373CDBEAE}" Type="VT_INT" Value="0"/>
<Parameter Name="[ME] Search range" GUID="{24A9A884-C4A0-4B5C-ACB3-212B3DBD7E04}" Type="VT_INT" Value="127"/>
<Parameter Name="[ME] Allow out of picture MVs" GUID="{3FCFB0A8-92B0-4273-AB86-55F8918AA64B}" Type="VT_INT" Value="1"/>
<Parameter Name="[ME] Number of reference frames" GUID="{79686095-968E-4CE8-9247-6633F6F8DA3C}" Type="VT_INT" Value="2"/>
<Parameter Name="[ME] Use subblock search" GUID="{8BC69F4F-6BE5-4FD7-90AE-D58DB21851A3}" Type="VT_BSTR" Value="Yes"/>
<Parameter Name="[ME] Subpixel depth" GUID="{8A5932D3-8860-454A-8A5B-4AE914AFE6E5}" Type="VT_BSTR" Value="Quarter Pel"/>
<Parameter Name="[ME] Enable weighted prediction" GUID="{FED84B7F-2006-4C6D-A49B-F1C0FE6A4F6F}" Type="VT_BSTR" Value="No"/>
<Parameter Name="[ME] Enable fast sub-block ME" GUID="{62AEEF4F-C52A-47C2-8F73-1CE7AF1B84E0}" Type="VT_BSTR" Value="No"/>
<Parameter Name="[ME] Enable fast multi-ref ME" GUID="{52FD80EF-B814-4696-AB6A-F0BF188EAC1E}" Type="VT_BSTR" Value="No"/>
<Parameter Name="[RDO] Entropy coding mode" GUID="{39178668-4FF1-4991-A76B-1B6D54F709B2}" Type="VT_BSTR" Value="CAVLC"/>
<Parameter Name="[RDO] Enable RD optimization" GUID="{9E63E1BB-08E3-42BE-87CE-05D2F770361E}" Type="VT_BSTR" Value="Yes"/>
<Parameter Name="[RDO] Enable Hadamard SATD" GUID="{29D87C71-49A4-4F67-B90D-BA821B58FE22}" Type="VT_BSTR" Value="Yes"/>
<Parameter Name="[RDO] Enable fast RD optimization" GUID="{48698A0E-D675-46B6-86EF-3D4E2C3ECAC3}" Type="VT_BSTR" Value="No"/>
<Parameter Name="[RDO] Enable fast inter decision" GUID="{2FE6D1AB-E54C-4AFE-9566-44EEFBDFE321}" Type="VT_BSTR" Value="No"/>
<Parameter Name="[RDO] Enable fast intra decision" GUID="{51BB55A6-D4AA-4D3A-AED4-D3DC2C61851C}" Type="VT_BSTR" Value="No"/>
<Parameter Name="[RDO] Quantization mode" GUID="{BBE49AA7-8ABA-4FD6-804D-00D129DCC458}" Type="VT_BSTR" Value="Mode2"/>
<Parameter Name="[LF] Use deblocking filter" GUID="{5FB3CC3C-67D6-42F6-AA9C-6AC05093661E}" Type="VT_INT" Value="1"/>
<Parameter Name="[LF] Deblocking alpha c0 offset" GUID="{37882133-CAF5-4373-8F52-BA30068A704A}" Type="VT_INT" Value="-1"/>
<Parameter Name="[LF] Deblocking beta offset" GUID="{F3049DC2-D2AD-484A-B2B9-4208051AFCB2}" Type="VT_INT" Value="-1"/>
<Parameter Name="[IP] Enable I_16x16 mode in intra slices" GUID="{DE932BFB-3D4B-4B27-B81C-371560C23541}" Type="VT_BSTR" Value="Yes"/>
<Parameter Name="[IP] Enable I_8x8 mode in intra slices" GUID="{446D663D-161F-4C3A-8A0B-72BA3096FB2A}" Type="VT_BSTR" Value="No"/>
<Parameter Name="[IP] Enable I_4x4 mode in intra slices" GUID="{0A4AAC0E-F7E0-4060-8C57-C290E7383E5E}" Type="VT_BSTR" Value="Yes"/>
<Parameter Name="[IP] Enable I_PCM mode in intra slices" GUID="{055AF531-B06A-4927-B029-1472067DDDFF}" Type="VT_BSTR" Value="No"/>
<Parameter Name="[IP] Enable I_16x16 mode in inter slices" GUID="{FDCF749C-64F8-4E43-9299-6A3ED103F9FF}" Type="VT_BSTR" Value="Yes"/>
<Parameter Name="[IP] Enable I_8x8 mode in inter slices" GUID="{412E3E96-0C95-4EC4-83A8-1FA4D82CE155}" Type="VT_BSTR" Value="No"/>
<Parameter Name="[IP] Enable I_4x4 mode in inter slices" GUID="{28F1BC58-A32E-4BFD-855E-CA460634E44E}" Type="VT_BSTR" Value="Yes"/>
<Parameter Name="[IP] Enable I_PCM mode in inter slices" GUID="{AED18519-8B8B-4676-88C3-1E6A136F767D}" Type="VT_BSTR" Value="No"/>
<Parameter Name="[AR] Use SAR" GUID="{E3ABEECF-D068-41BC-8FC2-A99A5EAA08C1}" Type="VT_BSTR" Value="Yes"/>
<Parameter Name="[AR] PAR Auto Mode" GUID="{B80A21B6-5DE1-4676-9D3C-2F9B5D074444}" Type="VT_BSTR" Value="Yes"/>
<Parameter Name="[AR] PAR X" GUID="{93055399-DC58-4917-B206-88976B7BADEA}" Type="VT_INT" Value="4"/>
<Parameter Name="[AR] PAR Y" GUID="{4B844BD8-5B63-44DF-9FF7-EE544AC19D85}" Type="VT_INT" Value="3"/>
<Parameter Name="[AR] SAR Auto Mode" GUID="{598C7279-6AE2-4B3E-947C-6DA0C69F3A01}" Type="VT_BSTR" Value="No"/>
<Parameter Name="[AR] SAR X" GUID="{80B714D9-EDCD-4CD5-AED7-20FC376B1DA5}" Type="VT_INT" Value="1"/>
<Parameter Name="[AR] SAR Y" GUID="{603B2F96-C82F-4610-ADE3-4F2BA9C7BD33}" Type="VT_INT" Value="1"/>
<Parameter Name="[Misc] Stream type" GUID="{A541970F-4E41-4C81-9CC7-0B2BE385691C}" Type="VT_BSTR" Value="Type II"/>
<Parameter Name="[Misc] Full range colors" GUID="{4E9B99A5-A388-452A-9B2D-C26B1230B210}" Type="VT_BSTR" Value="No"/>
<Parameter Name="[Misc] Write access unit delimiters" GUID="{4586F612-A991-4010-8414-14763B3527F4}" Type="VT_BSTR" Value="Yes"/>
<Parameter Name="[Misc] Write end of sequence code" GUID="{10AD7FE6-D3ED-4238-803B-630DBF7E8B0A}" Type="VT_BSTR" Value="Yes"/>
<Parameter Name="[Misc] Write timestamps" GUID="{C8CA406B-8220-4070-B5BE-1E27E4079147}" Type="VT_BSTR" Value="Yes"/>
<Parameter Name="[Misc] CPU optimization" GUID="{5E431140-B9E4-424F-A90F-F067EBFEC28F}" Type="VT_BSTR" Value="Auto"/>
<Parameter Name="[Misc] Max number of threads" GUID="{39108716-B2F5-491C-9E9B-C2ABF38475B4}" Type="VT_BSTR" Value="Auto"/>
<Parameter Name="[Misc] Calculate PSNR" GUID="{5CCB6D1B-BFCC-4F88-92DC-ADEAADF78B34}" Type="VT_BSTR" Value="No"/>
<Parameter Name="[Misc] Set default values" GUID="{B1E3E1BF-6225-4351-862C-66989AEE22B4}" Type="VT_BSTR" Value="No"/>
<Parameter Name="[State] Is running" GUID="{D0D2A38C-8DF6-47B5-A662-47E6D39BCFA7}" Type="VT_BSTR" Value="No"/>
<Parameter Name="[State] Original frame rate" GUID="{D02685C0-0946-4740-A6E7-504D750FE4F1}" Type="VT_R8" Value="25.000000"/>
<Parameter Name="[State] Original frame type" GUID="{654207C6-ECAD-4E8F-86F1-7819148D518A}" Type="VT_BSTR" Value="Frame pictures"/>
<Parameter Name="[State] Original color space" GUID="{413AA8BB-F85C-4768-B8F6-91AA7BCE3DE6}" Type="VT_BSTR" Value="YUV 4:2:0"/>
<Parameter Name="[State] Encoded frames" GUID="{16A9C0E0-9565-4AC8-91C7-82F5B59A0391}" Type="VT_INT" Value="0"/>
<Parameter Name="[State] Average FPS" GUID="{A1885A39-275D-45ED-8AC1-DB37FA64D7CD}" Type="VT_R8" Value="0.000000"/>
<Parameter Name="[State] Overall PSNR" GUID="{F0DCB6C2-F08B-4C87-97BF-E62E09C64C5D}" Type="VT_R8" Value="0.000000"/>
<Parameter Name="[State] Real bitrate" GUID="{8AC75EE6-7F3A-4D51-BE5C-BCC510EC3EB5}" Type="VT_R8" Value="0.000000"/>
<Parameter Name="[State] Horizontal size" GUID="{DE6D6008-1A49-428A-B2ED-E760FF32909E}" Type="VT_INT" Value="640"/>
<Parameter Name="[State] Vertical size" GUID="{D44C9617-C618-4D57-A992-DB8101911B4A}" Type="VT_INT" Value="480"/>
<Parameter Name="[State] OEM Name" GUID="{F9041053-1903-4497-82C4-519F0DA71196}" Type="VT_BSTR" Value="Consumer product"/>
<Parameter Name="[State] Evaluation state" GUID="{AFE11383-84D7-4F83-B114-ADC382F97D71}" Type="VT_BSTR" Value="Full mode"/>

benwaggoner
3rd September 2008, 06:56
Ugh. Something so painfully confusing that not even Doom9 can figure it out :)?

I'd be happy to share the magic Zune WMV settings...

Sagittaire
3rd September 2008, 07:21
Try simply Mainconcept ... or that with x264:



@REM -----------------------------------------------------------
@REM
@REM Profil IPod extra high quality
@REM
@REM -----------------------------------------------------------


@REM Source file name (suffit de mettre la source ici)
set E_SRC=Lossless.avs

@REM Set of quality (ici la qualité 1-50)
set E_BR=21.3

@REM Set of max bitrate (ici le bitrate max)
set MAX_BR=2400

@REM Set of Buffer (ici le buffer)
set BUF_BR=2000



@REM Profil

x264.exe --threads auto --thread-input --no-cabac --keyint 120 --min-keyint 1 --crf %E_BR% --vbv-maxrate %MAX_BR% --vbv-bufsize %BUF_BR% --mvrange 127 --level 3.0 --bframe 0 --ref 4 --mixed-refs --direct auto --deblock -2:-2 --partitions "i4x4" --me "umh" --subme 7 --trellis 0 --no-fast-pskip --no-dct-decimate --progress -o ipod.mp4 %E_SRC%

pause

Inventive Software
3rd September 2008, 12:18
@Ben:
H.264 video, up to 2.5 Mbps, 640 by 480 pixels, 30 frames per second, Baseline Profile up to Level 3.0 with AAC-LC audio up to 160 Kbps, 48kHz, stereo audio in .m4v, .mp4, and .mov file formats

This is the key part. From that, we deduce that Baseline Profile is enforced, maximum level is 3.0, max bitrate is 2500 Kbps / 2.5 Mbit frame size and rate is 640x480@30 FPS or a multiple not exceeding it, and AAC-LC audio at 48 KHz 160 Kbps in MP4.

Baseline has these restrictions compared to Main according to Wikipedia:

No B-frames
No CABAC, just CAVLC

In short:
x264.exe --level 3.0 --bframes 0 --no-cabac --mixed-refs
And add the VBV command line to stop it going over 2.5 Mbps.

I don't know what the partition sizes allowed are.

Sharktooth
3rd September 2008, 12:53
uhm... lets see. i have p8x8 and b8x8 in the level1.3 presets and no partitions in the level 3.0 presets.
the mainconcept/elecard preset shows i4x4 enabled (that makes me suppose it is able to decode p4x4 too)...
my question is: is the ipod accepting the same partitions for both profiles (1.3 and 3.0)?

EDIT: the answer came from the handbrake presets. it accepts all partitions types availabe at baseline profile for the chosen level (1.3 or 3.0).

Dark Shikari
3rd September 2008, 16:00
the mainconcept/elecard preset shows i4x4 enabled (that makes me suppose it is able to decode p4x4 too)...Completely unrelated--i4x4 has nothing to do with p4x4. But yes, it probably can, because if it couldn't, it wouldn't be spec-compliant to any sense of the term.

Comatose
3rd September 2008, 16:30
it wouldn't be spec-compliant to any sense of the term.
Some of these companies don't seem to care in the least :\

Theliel
3rd September 2008, 18:59
iPod Classic supports Level 1.3 only, not 3.0.

Some time ago I tested all possibility with my iPod Touch, but its possible will be different for Classic.

In Apple Specification tables show the same spec for Touch and classic (no 5.5G) for Video.

In My old 5.5G this is a little different:

Max bitrate = 1.5Mb/s
Only 1-2 ref frames
Max Res: 640*480

IMHO, iPod Classic and Touch exceed Apple Specification. For example, for iPod Touch Apple Spec: 2.5Mb/s Max and 640*480, and this is false, i have a lot of test about this, the max bitrare are 10Mb/s, and the same for resolution, so support PAL and NTSC.

I dont know Apple reason for cap some values.

About partitions, 5.5G and Touch work perfectly with p8x8,b8x8,i4x4,p4x4 partition. So I Suppose iPod Classic work fine too.

The only thing i havent tried its test my Touch profile in a iPod Classic, but its very possible that work fine too. (I can try this in some hours)

Schrade
4th September 2008, 00:12
Ugh. Something so painfully confusing that not even Doom9 can figure it out :)?

I'd be happy to share the magic Zune WMV settings...

Rather than just talking about it you should just do it. Give us an explanation about what the highest settings the Zune can use and also what formats it supports.

Profiles that work for Apple's devices have been out there for a long time now but it's difficult to nail down the exact highest settings since there's so many different versions.

benwaggoner
4th September 2008, 01:27
Rather than just talking about it you should just do it. Give us an explanation about what the highest settings the Zune can use and also what formats it supports.
Sorry, I was just joking because we've already got pretty clear documentation out there, compared to the somewhat amazing thread here :).

I did this blog post for the original Zune 30 (the only tricky one to encode for):

http://on10.net/blogs/benwagg/Encoding-for-the-Zune/

Formal details are here:
http://www.zune.net/en-us/support/usersguide/podcasts/create.htm

We have a more flexible MPEG-4 implementation than iPod, since there's no weird Baseline variant, and we support the full SD resolutions (720x480p30 and 720x576p25).

If there's any additional detail that would be useful or interesting, let me know and I'll see what I can track down.

teddg
4th September 2008, 05:09
Then there's all sorts of other funkiness, like whether the max bitrate is audio and video combined, why some videos just won't work, why some odd high resolutions work but others don't, only at particular bitrates, or how replacing the MP4 after it's been synced with iTunes sometimes works for non-syncing files... etc... I gave up on iPod encoding a LONG time ago. It's just not worth it :p

I use ffmpeg and haven't had a problem in the last several dozen movies. see this (http://forum.doom9.org/showthread.php?t=135049) thread.

F J Walter
4th September 2008, 07:49
I have found these two pages to be quite helpful.

http://rob.opendot.cl/index.php/useful-stuff/ipod-video-guide/
http://rob.opendot.cl/index.php/useful-stuff/ffmpeg-x264-encoding-guide/

Note: parts of it may be out of date, especially if you recompiled x264 and ffmpeg very recently. But it is worth a look.

Also, after trawling through Apple pages I also came up with some information for my own purposes:


Apple Ipod (>=6G) / Iphone / Itouch:
40500 macroblocks per second?
1620 macroblocks
10 MBit/s, 10 MBits buffer
supports
720x480 at 30fps (6 stored)
720x576 at 25fps (5 stored)
Restrictions:
No B-slices
No CABAC
No pixel aspect ratio support, but widescreen is supported for common resolutions??
Probably no 8x8 vs 4x4 and no interlaced?
For iTunes sync, average bitrate over whole file must be < 5 MBit/s (iPod classic/nano, not touch/iphone)

Apple Ipod Video (5G only, see other models above)
unknown macroblocks per second, see support below
1200 macroblocks
2.5 MBit/s, 2 MBits buffer
supports
640x480 at 30fps (2 stored)
Restrictions:
No B-slices
No CABAC
1:1 pixel aspect ratio
Probably no 8x8 vs 4x4 and no interlaced?

More information:
http://en.wikipedia.org/wiki/H.264
http://rob.opendot.cl/index.php/useful-stuff/h264-profiles-and-levels/
http://forum.handbrake.fr/viewtopic.php?f=7&t=3859

Note that above, I understand that you need to set "refs" to one or two lower than the value I have for "stored". Question marks indicate areas where I'm not sure. I really don't know what I meant where I wrote "Probably no 8x8 vs 4x4"; maybe I was just unsure whether 8x8 and 4x4 partitions on P/B blocks were supported.

smok3
4th September 2008, 09:22
i would need a magic, best possible quality (all generation pods) x264 command line?

Sharktooth
4th September 2008, 12:53
Some time ago I tested all possibility with my iPod Touch, but its possible will be different for Classic.

In Apple Specification tables show the same spec for Touch and classic (no 5.5G) for Video.

In My old 5.5G this is a little different:

Max bitrate = 1.5Mb/s
Only 1-2 ref frames
Max Res: 640*480

IMHO, iPod Classic and Touch exceed Apple Specification. For example, for iPod Touch Apple Spec: 2.5Mb/s Max and 640*480, and this is false, i have a lot of test about this, the max bitrare are 10Mb/s, and the same for resolution, so support PAL and NTSC.

I dont know Apple reason for cap some values.

About partitions, 5.5G and Touch work perfectly with p8x8,b8x8,i4x4,p4x4 partition. So I Suppose iPod Classic work fine too.

The only thing i havent tried its test my Touch profile in a iPod Classic, but its very possible that work fine too. (I can try this in some hours)
10mbits is exactly the max peak bitrate, but it cant be sustained. The low buffer doesnt allow it (unless new models have a bigger buffer). 2.5 is the max sustained bitrate.

@smoke: --bitrate 600 --stats ".stats" --level 1.3 --no-cabac --subme 6 --partitions all --qpmin 16 --vbv-bufsize 768 --vbv-maxrate 768 --me umh --merange 12 ---> for 320x240
or
--bitrate 1000 --stats ".stats" --level 3 --nf --no-cabac --subme 6 --partitions p8x8,b8x8,i4x4 --qpmin 16 --vbv-bufsize 1500 --vbv-maxrate 1500 --me umh --merange 12 ---> for 640x480

Sagittaire
4th September 2008, 13:21
10mbits is exactly the max peak bitrate, but it cant be sustained. The low buffer doesnt allow it (unless new models have a bigger buffer). 2.5 is the max sustained bitrate.

@smoke: --bitrate 600 --stats ".stats" --level 1.3 --no-cabac --subme 6 --partitions all --qpmin 16 --vbv-bufsize 768 --vbv-maxrate 768 --me umh --merange 12 ---> for 320x240
or
--bitrate 1000 --stats ".stats" --level 3 --nf --no-cabac --subme 6 --partitions p8x8,b8x8,i4x4 --qpmin 16 --vbv-bufsize 1500 --vbv-maxrate 1500 --me umh --merange 12 ---> for 640x480


From mainconcept ipod seem not support 8x8 partitions. From x264 help p4x4 require p8x8 and i8x8 require --8x8dct (HP). You must only use i4x4 for partitions with x264.

Sharktooth
4th September 2008, 13:29
where do you see i8x8 in my commandlines (--partitions all automatically disables i8x8 when --8x8dct is not specified) and where do you see p4x4 without p8x8? however ipods seem to actually support p and b 8x8 partitions...

Dark Shikari
4th September 2008, 16:17
From mainconcept ipod seem not support 8x8 partitions. From x264 help p4x4 require p8x8 and i8x8 require --8x8dct (HP). You must only use i4x4 for partitions with x264.Wrong again... iPod supports p8x8 just fine. The Mainconcept API doesn't have a "p8x8" option; it just calls them "partitions."

The iPod is not particularly weird; it supports pretty much exactly what its supposed to.

F J Walter
5th September 2008, 02:45
10mbits is exactly the max peak bitrate, but it cant be sustained. The low buffer doesnt allow it (unless new models have a bigger buffer). 2.5 is the max sustained bitrate.

VBV specs are available on the Apple site. In short, the Apple Ipod Video 5th gen supports 2.5MBit/s with 2 MBit buffer with max res 640x480@30.

Later Ipods including 6th gen and later, the nano, touch and the iphone, support 10MBit/s with 10 Mbit buffer and max res 720x576@25 or 720x480@30.

So yes, the new models have bigger buffer and support higher bitrate.

See my post above for more info.

Sharktooth
5th September 2008, 03:03
thanks for clarifying. where did i put my head? i also already had a iPhone profile for megui...

Sagittaire
5th September 2008, 06:51
Wrong again... iPod supports p8x8 just fine. The Mainconcept API doesn't have a "p8x8" option; it just calls them "partitions."

The iPod is not particularly weird; it supports pretty much exactly what its supposed to.

it's not that ... ?

<Parameter Name="[IP] Enable I_16x16 mode in intra slices" GUID="{DE932BFB-3D4B-4B27-B81C-371560C23541}" Type="VT_BSTR" Value="Yes"/>
<Parameter Name="[IP] Enable I_8x8 mode in intra slices" GUID="{446D663D-161F-4C3A-8A0B-72BA3096FB2A}" Type="VT_BSTR" Value="No"/>
<Parameter Name="[IP] Enable I_4x4 mode in intra slices" GUID="{0A4AAC0E-F7E0-4060-8C57-C290E7383E5E}" Type="VT_BSTR" Value="Yes"/>
<Parameter Name="[IP] Enable I_PCM mode in intra slices" GUID="{055AF531-B06A-4927-B029-1472067DDDFF}" Type="VT_BSTR" Value="No"/>
<Parameter Name="[IP] Enable I_16x16 mode in inter slices" GUID="{FDCF749C-64F8-4E43-9299-6A3ED103F9FF}" Type="VT_BSTR" Value="Yes"/>
<Parameter Name="[IP] Enable I_8x8 mode in inter slices" GUID="{412E3E96-0C95-4EC4-83A8-1FA4D82CE155}" Type="VT_BSTR" Value="No"/>
<Parameter Name="[IP] Enable I_4x4 mode in inter slices" GUID="{28F1BC58-A32E-4BFD-855E-CA460634E44E}" Type="VT_BSTR" Value="Yes"/>
<Parameter Name="[IP] Enable I_PCM mode in inter slices" GUID="{AED18519-8B8B-4676-88C3-1E6A136F767D}" Type="VT_BSTR" Value="No"/>


where do you see p4x4 without p8x8? however ipods seem to actually support p and b 8x8 partitions...

Well I read simply the mainconcept profil for iPod. In the x264help ...

"(p4x4 requires p8x8. i8x8 requires --8x8dct.)"

Dark Shikari
5th September 2008, 07:03
it's not that ... ?

<Parameter Name="[IP] Enable I_16x16 mode in intra slices" GUID="{DE932BFB-3D4B-4B27-B81C-371560C23541}" Type="VT_BSTR" Value="Yes"/>
<Parameter Name="[IP] Enable I_8x8 mode in intra slices" GUID="{446D663D-161F-4C3A-8A0B-72BA3096FB2A}" Type="VT_BSTR" Value="No"/>
<Parameter Name="[IP] Enable I_4x4 mode in intra slices" GUID="{0A4AAC0E-F7E0-4060-8C57-C290E7383E5E}" Type="VT_BSTR" Value="Yes"/>
<Parameter Name="[IP] Enable I_PCM mode in intra slices" GUID="{055AF531-B06A-4927-B029-1472067DDDFF}" Type="VT_BSTR" Value="No"/>
<Parameter Name="[IP] Enable I_16x16 mode in inter slices" GUID="{FDCF749C-64F8-4E43-9299-6A3ED103F9FF}" Type="VT_BSTR" Value="Yes"/>
<Parameter Name="[IP] Enable I_8x8 mode in inter slices" GUID="{412E3E96-0C95-4EC4-83A8-1FA4D82CE155}" Type="VT_BSTR" Value="No"/>
<Parameter Name="[IP] Enable I_4x4 mode in inter slices" GUID="{28F1BC58-A32E-4BFD-855E-CA460634E44E}" Type="VT_BSTR" Value="Yes"/>
<Parameter Name="[IP] Enable I_PCM mode in inter slices" GUID="{AED18519-8B8B-4676-88C3-1E6A136F767D}" Type="VT_BSTR" Value="No"/>None of those says "p8x8" in them. They're all intra macroblock types.

Sagittaire
5th September 2008, 07:27
None of those says "p8x8" in them. They're all intra macroblock types.

8x8 inter mode is not p8x8 and b8x8 ... ?

Dark Shikari
5th September 2008, 07:40
8x8 inter mode is not p8x8 and b8x8 ... ?Yes, it is... the point being that none of the stuff you posted says "p8x8 and b8x8 aren't used in iPod profiles". In fact, good thing I know a bit about Mainconcept's API:

<Parameter Name="[ME] Use subblock search" GUID="{8BC69F4F-6BE5-4FD7-90AE-D58DB21851A3}" Type="VT_BSTR" Value="Yes"/>

This is equivalent to --partitions p8x8,b8x8 in x264. Mainconcept doesn't have support for p4x4 to begin with, but that doesn't mean its not allowed.

Schrade
5th September 2008, 07:43
Sorry, I was just joking because we've already got pretty clear documentation out there, compared to the somewhat amazing thread here :).

I did this blog post for the original Zune 30 (the only tricky one to encode for):

http://on10.net/blogs/benwagg/Encoding-for-the-Zune/

Formal details are here:
http://www.zune.net/en-us/support/usersguide/podcasts/create.htm

We have a more flexible MPEG-4 implementation than iPod, since there's no weird Baseline variant, and we support the full SD resolutions (720x480p30 and 720x576p25).

If there's any additional detail that would be useful or interesting, let me know and I'll see what I can track down.
Thanks for this, Ben. This helps folks like me who are looking to add more device support into products.

You might want to even split this off into its own thread since I'm sure people wouldn't expect to find Zune settings in an iPod thread ;)

vmrsss
5th September 2008, 11:26
IIRC, the iPod Classic supports L1.3 at up to 768kb/s, and L3.0 at up to 1.5mb/s. Why the separation? A 320x240 video won't work at higher than 768kb/s... but a 640x480 video will. Don't ask.

Can anybody explain to me why Apple feels necessary to specify this in this form? Surely 640x480 up to L3.0 and 1.5Mb/s subsumes 320x240 at 768Kb/s. (And in fact, my ipod 5.5G can to 320x240 at 2.5Mb/s.) What is the interest in declaring the lesser capabilities?

Thx

vmrsss
5th September 2008, 12:13
Hi there.

There is a lot of imprecise information out there about encoding for the ipod (including some in this thread). For instance, I can guarantee you that on my ipod 5.5G (and therefore a fortiori on ipod >= 6G):

(1) 2.5Mb/s with --ref 5 and peakrates well above 2Mb it's just fine

(2) SARs different from 1:1 are just fine (both on the ipod, and on the TV out -- but not in iTunes: only once I managed to get iTunes to oblige the aspect ratio, using a mov container, but I couldn't replicate that ever again; it's all a big mystery to me...)

Would it be good to set the record straight on this?

Edited: I should have specified clearly that --ref 5 works only up to certain sizes (eg 640x252 yes, 640x272 stutters, 640x352 crashes)

F J Walter
8th September 2008, 08:09
(2) SARs different from 1:1 are just fine

I am curious about this, because when I read about it on the Apple site it seemed to indicate that there were two ways of specifying aspect ratio in the video, and that one didn't work - unfortunately I didn't understand what this meant. Would it depend on the muxer used? Or will any h.264 encoded by x264 properly preserve the pixel aspect ratio on an iPod?

Bathrone
10th September 2008, 00:42
After reading this thread Im greatly confused now.

1. If the Iphone 3G can do 720x480 why do Apple who make the product have the video tech specs at considerably less resolution?

2. Can someone please help me out, and no doubt others too, by providing an x264 command line that would give the highest possible quality experience regardless of encode time for the 3g Iphone (not being concerned with older gear like ipods - optimised for 3g Iphone). Thanks very much.

Regards

EDIT: This is what Ive got so far:

mencoder (inputfile) \
-o test.mp4 -vf scale=720:400,harddup -ovc x264 -ofps 23.976 \
-x264encopts level=30:no-cabac:bframes=0:trellis=0:ref=5:mixed-refs:no-fast-pskip:\
me=umh:merange=24:subme=7:partitions=all:direct=auto:threads=auto:deblock:keyint=240:bitrate=4500:pass=1 \
-oac faac -faacopts br=128:mpeg=4:object=2 -channels 2 -srate 48000

I know the bitrate isnt right Im just trying to get things started

vmrsss
10th September 2008, 11:46
I am curious about this, because when I read about it on the Apple site it seemed to indicate that there were two ways of specifying aspect ratio in the video, and that one didn't work - unfortunately I didn't understand what this meant. Would it depend on the muxer used? Or will any h.264 encoded by x264 properly preserve the pixel aspect ratio on an iPod?

Not sure what you are referring to, possibly DAR vs SAR? Anyway, I know the following as facts:

(1) ffmpeg will produce anamorphic encodes (via the -aspect option and the -f ipod switch) that the ipod will play just fine, regardless of whether the container is MP4 or M4V. (ffmpeg adds the right atoms to the containers, so no further steps needed here. You can work with a MOV container too, but things become slightly more involved.)

(2) x264 will produce anamorphic encodes (via the --sar option) that the ipod will play just fine when it outputs to MP4. (Here you must run the resulting file through AtomicParsley to add suitable atoms to the MP4 in order for the ipod to accept it via iTunes.)

(3) With output from x264 to MKV or h264, MP4Box (without the -ipod flag) will mux anamorphic encodes that the ipod will play just fine. (Again, here you need to pass the file through AtomicParsley. Incidentally, I could not get MP4Box's -ipod switch to work at all.)

As I said, iTunes will not play the encodes with the right aspect ratio. I don't know how to fix that: I gave it a go sometime ago, failed, and I am not motivated to invest time on it, as I find wanting to play any serious encode in iTunes somewhat devious:

After all, this is only useful if you want to plug the ipod to a TV, as 640x480 anamorphic is quite close to DVD standards (even more so if you have a 6G and can go up to 720, which I don't). Tried that with an S-VIDEO connector, that would not be my first choice in an ideal world, but I can think of situations where what I got would be considered pretty decent. If instead one plans to play on the ipod itself, then really I can see no good reason to do anything else than width=320 (480 on a 6G) and sar=1.

Hope this helps.

RsVolcom
21st October 2008, 02:21
2. Can someone please help me out, and no doubt others too, by providing an x264 command line that would give the highest possible quality experience regardless of encode time for the 3g Iphone (not being concerned with older gear like ipods - optimised for 3g Iphone). Thanks very much.

I use VirtualDub to generate my script as far as cropping, deinterlacing and resizing. Then I determine the lowest possible bitrate that produces a great image and encode it using Sharktooth's iPhone profile at the predetermined bitrate. For the audio just use ND AAC and mux.

On Resizing: As opposed to talking about the maximum possible supported resolution, I always resize to the actual resolution of the device (or match longest sides and resize the shorter one to the proper ratio). I haven't tested my iPhone, but when I tested my nano3G I got ~30% longer battery life by not forcing the processor to resize the image.

After muxing a program called mp4creator will allow you to mux chapters the iPhone/iPod can read.

A program called tagger.jar will allow you to tag the files as TV shows and add release dates, MPAA ratings and a lot more if you wish.

Gabriel_Bouvigne
21st October 2008, 13:34
Aspect ratio is mostly a matter of muxing: iPhone and iPod Touch both require the PASP atom within the mp4 container in order to display the proper aspect ratio. PASP was defined in 14496-12/AMD1:2007 (ie it was not part of the first edition of the mp4 file format specifications).

ScootyPuffJr
11th January 2009, 10:35
I was digging around on Apple's site and found the following specs for the apple Devices:

iPod 5.5G

H.264 video, up to 768 Kbps,
320 by 240 pixels, 30fps
Baseline Profile up to Level 1.3
AAC-LC audio up to 160 Kbps, 48kHz, stereo audio
in .m4v, .mp4, and .mov file formats;

MPEG-4 video, up to 2.5 Mbps,
640 by 480 pixels, 30fps
Simple Profile
AAC-LC audio up to 160 Kbps, 48kHz,
in .m4v, .mp4, and .mov file formats

iPhone / iPod 5thGen (Late 2006)

H.264 video, up to 1.5 Mbps,
640 by 480 pixels, 30fps,

Low-Complexity Baseline Profile
AAC-LC audio up to 160 Kbps, 48kHz,
in .m4v, .mp4, and .mov file formats;

H.264 video, up to 768 Kbps,
320 by 240 pixels, 30fps
Baseline Profile up to Level 1.3
AAC-LC audio up to 160 Kbps, 48kHz, stereo audio
in .m4v, .mp4, and .mov file formats;

MPEG-4 video, up to 2.5 Mbps,
640 by 480 pixels, 30fps
Simple Profile
AAC-LC audio up to 160 Kbps, 48kHz,
in .m4v, .mp4, and .mov file formats

iPhone3G / Touch / Classic / Nano 3gen+

H.264 video, up to 1.5 Mbps,
640 by 480 pixels, 30fps,

Low-Complexity Baseline Profile
AAC-LC audio up to 160 Kbps, 48kHz,
in .m4v, .mp4, and .mov file formats;

H.264 video, up to 2.5 Mbps
640 by 480 pixels, 30fps
Baseline Profile up to Level 3.0
AAC-LC audio up to 160 Kbps, 48kHz, stereo audio
in .m4v, .mp4, and .mov file formats;

MPEG-4 video, up to 2.5 Mbps,
640 by 480 pixels, 30fps
Simple Profile
AAC-LC audio up to 160 Kbps, 48kHz,
in .m4v, .mp4, and .mov file formats

AppleTV

H.264 video up to 5 Mbps,
1280 by 720 pixels at 24 fps,
960 by 540 pixels at 30 fps
Progressive Main Profile (CAVLC)
AAC-LC audio up to 160 Kbps
in .m4v, .mp4, and .mov file formats

iTunes Store video:
320 by 240 pixels,
640 by 480 pixels,
720 by 480 pixels (anamorphic),
high-definition 720p

MPEG-4: Up to 3 Mbps,
720 by 432 pixels at 30 fps
Simple Profile
AAC-LC audio up to 160 Kbps
in .m4v, .mp4, and .mov file formats


My non-3G iPhone and iPod Classic both play H.264 1.5MB/sec 853x480 content from Apple just fine, even thought the specs for both cap the size at 640.