creating h264 640x480 iPod 5 (v1.2) files

About encoding, codec settings, muxers and filter usage
nkarnold
Blank Cone
Blank Cone
Posts: 12
Joined: 20 Sep 2006 13:47

creating h264 640x480 iPod 5 (v1.2) files

Postby nkarnold » 04 Mar 2007 01:54

Hi All,

Im trying to find out how to create h264 640x480 iPod 5.5 video files

Ive no problems at all, creating MPEG4 video files for iPod use.

I know it needs -nocabac and 0 -bframes on the x264 sout options, but I can't get iTunes to accept the file.

I've passed the x264 mp4 file through the 'modified' version of MP4box, which changes the atoms to allow iTunes to accept the file.. but still no joy.

Any help appreciated

Cheers

n

jwt2d
New Cone
New Cone
Posts: 5
Joined: 05 Mar 2007 16:14

Postby jwt2d » 05 Mar 2007 16:28

With reference to ezbuilder, the h264 video stream can be generated by the following x264 command line:

x264.exe --no-cabac --level 30 --progress --me umh -m 7 -A all --crf 23 --sar 1:1 -o output_file input_file

Since the x264 library in VLC is different from x264 used in ezbuilder, I specify every option in VLC to match the setting used in ezbuilder. Here is the batch file I used in VLC:

------------------
"c:\program files\videolan\vlc\vlc.exe" ^
%1 ^
vlc:quit ^
--aspect-ratio 1:1 ^
--file-logging ^
--verbose 2 ^
--color ^
--sout-transcode-vcodec h264 ^
--sout-transcode-vb 200 ^
--sout-transcode-acodec mp4a ^
--sout-transcode-ab 128 ^
--sout-transcode-channels 2 ^
--sout-transcode-audio-sync ^
--sout-transcode-deinterlace ^
--sout-transcode-width 640 ^
--sout-transcode-canvas-height 480 ^
--sout-transcode-fps 24 ^
--sout-standard-access file ^
--sout-standard-mux mp4 ^
--sout-standard-url "%2" ^
--sout-x264-keyint 250 ^
--sout-x264-min-keyint 25 ^
--sout-x264-scenecut 40 ^
--sout-x264-bframes 0 ^
--sout-x264-b-adapt ^
--sout-x264-b-bias 0 ^
--no-sout-x264-bpyramid ^
--no-sout-x264-cabac ^
--sout-x264-ref 1 ^
--sout-x264-nf ^
--sout-x264-deblock "0:0" ^
--sout-x264-level 30 ^
--no-sout-x264-interlaced ^
--sout-x264-qp 26 ^
--sout-x264-crf 23 ^
--sout-x264-qpmin 10 ^
--sout-x264-qpmax 51 ^
--sout-x264-qpstep 4 ^
--sout-x264-ratetol 1.0 ^
--sout-x264-vbv-maxrate 0 ^
--sout-x264-vbv-bufsize 0 ^
--sout-x264-vbv-init 0.9 ^
--sout-x264-ipratio 1.40 ^
--sout-x264-pbratio 1.30 ^
--sout-x264-chroma-qp-offset 0 ^
--sout-x264-qcomp 0.60 ^
--sout-x264-cplxblur 20.0 ^
--sout-x264-qblur 0.5 ^
--sout-x264-partitions "all" ^
--sout-x264-direct "spatial" ^
--sout-x264-direct-8x8 -1 ^
--no-sout-x264-weightb ^
--sout-x264-me "umh" ^
--sout-x264-merange 16 ^
--sout-x264-subme 7 ^
--no-sout-x264-b-rdo ^
--no-sout-x264-mixed-refs ^
--sout-x264-chroma-me ^
--no-sout-x264-bime ^
--no-sout-x264-8x8dct ^
--sout-x264-trellis 0 ^
--sout-x264-fast-pskip ^
--sout-x264-dct-decimate ^
--sout-x264-nr 0 ^
--sout-x264-deadzone-inter 21 ^
--sout-x264-deadzone-intra 11 ^
--sout-x264-asm ^
--sout-x264-psnr ^
--sout-x264-ssim ^
--no-sout-x264-quiet ^
--sout-x264-sps-id 0 ^
--no-sout-x264-aud ^
--sout-x264-verbose ^
--sout "#transcode:std"
----------------

I cannot download the converted video into ipod through itunes even if I use the modified MP4Box to add the special atom.

Then, I split the converted video file into 264 and acc raw data and use the modified MP4Box to create a MP4 file agin. This time, I can download the file into ipod through itunes.

However, it cannot be playback on ipod.

I hope this information can help us to figure out how to generate h264 640x480 ipod 5.5 video files.

loqu
Blank Cone
Blank Cone
Posts: 24
Joined: 24 Jan 2007 09:49
Location: NYC
Contact:

Postby loqu » 06 Mar 2007 21:02

Wow. It looks like you're hardcore about it. Have you looked at the new wiki entry? http://wiki.videolan.org/IPod (Self-promoting, sorry.)

I've encoded many "5.5" files, with an output resolution of 640x480. I just use width=640,canvas-height=480 instead of width=320,canvas-height=240 if I want "5.5" files.

Of course you have the latest firmware on your iPod, and you're using vlc 0.8.6a?

Try it with the guide, and be sure to reset your prefs in vlc first.

Let me know if it helps.

jwt2d
New Cone
New Cone
Posts: 5
Joined: 05 Mar 2007 16:14

Postby jwt2d » 08 Mar 2007 15:47

The mentioned wiki page is useful. Thank you.

However, I can't play the video on ipod when I change from mp4v to h264 in vcodec even if I bypass itunes. ( there is a known issue in the latest itunes to check the special atom in MP4 container. ) The reason why I hardcode everything in x264 encoder because I want to make sure that the video stream format fulfill the requirement of ipod 5.5 ( firmware v1.2 )

loqu
Blank Cone
Blank Cone
Posts: 24
Joined: 24 Jan 2007 09:49
Location: NYC
Contact:

Postby loqu » 08 Mar 2007 16:22

jwt2d,

Did you download this file or do you have a copy that I can test so we can see exactly what's going on?

For the life of me, I've never had a problem with the "5.5" files. I've read about the ATOM problem with the MP4 container, but using mp4box has NEVER helped (really). I have iTunes 7.0.2, with the latest firmware for my iPod. Now, when I started iTunes today, I was asked to upgrade to 7.1, but I did not upgrade.

What version of iTunes do you have? Be sure to "reset" vlc to defaults (There should be a shortcut for that in your START menu if you used the 0.8.6a installer)

Is there a way I can try the conversion on a copy of your file? (PM me if you'd like ...)

If you can, I'd like to get to the bottom of this, and really find out what's going on. My goal is to get the guide on the wiki to work 100% of the time.

jwt2d
New Cone
New Cone
Posts: 5
Joined: 05 Mar 2007 16:14

Postby jwt2d » 09 Mar 2007 18:32

Your help is appreciated.

I can provide the test vector to reproduce the problem. I am using itunes 7.0.2.16 and firmware 1.2 on 5G ipod.

Ipod h264 video
http://us.f13.yahoofs.com/bc/44059177mf ... FB0ggZT744

Original video
http://us.f13.yahoofs.com/bc/44059177mf ... FBR_eWjT_E

loqu
Blank Cone
Blank Cone
Posts: 24
Joined: 24 Jan 2007 09:49
Location: NYC
Contact:

Postby loqu » 09 Mar 2007 19:20

cool. looking at it now ... give me some time, as I may not be able to do a full analysis today.

loqu
Blank Cone
Blank Cone
Posts: 24
Joined: 24 Jan 2007 09:49
Location: NYC
Contact:

Postby loqu » 09 Mar 2007 20:08

UH, not cool.

I cannot access any of your files. What's the address for your main briefcase? or PM me your yahoo ID. I should be able to access them at http://briefcase.yahoo.com/yahooID/; I'll be able to see the file from there.

Off hand, I've never tried converting the files from Windows Media Center. In fact, I don't even have any of those to sample.

So, now I'm really interested.

loqu
Blank Cone
Blank Cone
Posts: 24
Joined: 24 Jan 2007 09:49
Location: NYC
Contact:

Postby loqu » 10 Mar 2007 07:57

Well, I found a dvr-ms file on the mplayer website: http://samples.mplayerhq.hu/dvr_ms/ . I tested all of them according to the Ipod wiki entry, and I cannot transfer these files to my ipod at all. I get an error message that says that the ipod cannot play the file instead.

Let me look at this some more. Don't worry about the links with your sample files.

jwt2d
New Cone
New Cone
Posts: 5
Joined: 05 Mar 2007 16:14

Postby jwt2d » 10 Mar 2007 15:14

Thank you for your help. I am sorry for the access error in the test vector. I am happy when you found another dvr-ms file for testing. If you need anything, please let me know.

I spend a lot of time to deal with dvr-ms format and find out how to convert them into ipod playable file in many ways. VLC is the most comphensive/stable tool I would like to use for this purpose.

loqu
Blank Cone
Blank Cone
Posts: 24
Joined: 24 Jan 2007 09:49
Location: NYC
Contact:

Initial Findings

Postby loqu » 11 Mar 2007 03:04

Ok, just to summarize what's going on so far:
  • encoding using the MPEG4 (xvid?) video codec, there are no problems with converting and transfering dvr-ms, wmv, and/or asf files over to the iPod.
  • encoding using h264(x264, not ffmpeg) video codec, iTunes will not accept the file, nor will the iPod play the file if iTunes is bypassed.
I'm going on a limb, but I believe the problem lies within the mp4 container when using x264 to encode the video.

From just using "mp4box -info filename.mp4", I've noticed that when using x264 as the video encoder, the mp4 container has a profile of "Profile Unknown @ Level 5.1". The exact number can be tweaked in the GUI: Preferences->Input Codecs->Video Codecs ->x264->H.264 level. Changing this to 1.3 etc, does not allow the video to be imported into iTunes.

The same file, if opened in Quicktime and saved within Quicktime, will import into iTunes. MP4box lists the resultant profile as "Profile Baseline @ Level 1.3"

As you stated, jwt2d, you can demux the mp4 container from vlc and remux it with mp4box, which will result in a properly working video file.

How can we set the mp4 profile in vlc, when using the x264 codec? It must be able to get done, since the rest of the video community is using videolan.org's x264 library ... Is this a bug in the mp4 container? If so, why does it seem to only appear when using WMV files as input?

jwt2d, can you confirm the "mp4box -info" on your working and non-working files as well?

Thanks for you help, too.


MP4box output:
##### x264 encoder used to encode video #####
Z:\AA TV>mp4box.exe -info robotica_720_vlc.mp4
* Movie Info *
Timescale 90000 - Duration 00:00:19.750
Fragmented File no - 1 track(s)
File Brand isom - version 0
Created: GMT Sun Mar 11 15:33:56 2007

File has no MPEG4 IOD/OD

Track # 1 Info - TrackID 1 - TimeScale 1001 - Duration 00:00:19.749
Media Info: Language "Undetermined" - Type "vide:avc1" - 474 samples
MPEG-4 Config: Visual Stream - ObjectTypeIndication 0x21
AVC/H264 Video - Visual Size 320 x 240 - Profile Unknown @ Level 5.1
NAL Unit length bits: 32
Pixel Aspect Ratio 1:1 - Indicated track size 320 x 240
Self-synchronized

##### Same file as above, opened in quicktime and saved as "ipod format" video #####
Z:\AA TV>mp4box.exe -info robotica_720_qt.mp4
* Movie Info *
Timescale 90000 - Duration 00:00:19.750
Fragmented File no - 1 track(s)
File Brand M4V - version 1
Created: GMT Sun Mar 11 16:08:03 2007

File has no MPEG4 IOD/OD

Track # 1 Info - TrackID 1 - TimeScale 90000 - Duration 00:00:19.750
Media Info: Language "English" - Type "vide:avc1" - 474 samples
MPEG-4 Config: Visual Stream - ObjectTypeIndication 0x21
AVC/H264 Video - Visual Size 320 x 240 - Profile Baseline @ Level 1.3
NAL Unit length bits: 32
Self-synchronized

jwt2d
New Cone
New Cone
Posts: 5
Joined: 05 Mar 2007 16:14

Postby jwt2d » 12 Mar 2007 19:16

If I demux mp4 container from vlc and remux it with special mp4box ( with itunes atom ), I can download through itunes but I can't playback on ipod.

If we want to specify the profile level in x264 encoder, we can use "--sout-x264-level" option. That's why I define all setting value of x264 encoder in the previous post.

If I use your command line, the MP4Info output is:
Track Type Info
1 audio MPEG-4 AAC LC, 12.102 secs, 80 kbps, 44100 Hz
2 video H264 Unknown Profile 40@ 5.1, 11.719 secs, 721 kbps, 640x480 @ 25
.002133 fps
Metadata Name: test

If I use my command line, the MP4Info output is:
Track Type Info
1 audio MPEG-4 AAC LC, 12.160 secs, 109 kbps, 48000 Hz
2 video H264 Unknown Profile c0@3, 11.790 secs, 221 kbps, 640x480 @ 24.0
03393 fps
Metadata Name: test

Although I can change the profile level from 5.1 to 3, the profile name is still unknown. Maybe it is the root cause why we can't playback ipod even if I demux-remux MP4 container. We need to find out a way to generate "Profile Baseline @ Level 1.3" or "Profile Baseline @ Level 3.0" in vlc.

p.s. When I use MP4Box, I can generate the info similar to you. That's why I use MP4Info instead. Which MP4Box you are using?[/list]

loqu
Blank Cone
Blank Cone
Posts: 24
Joined: 24 Jan 2007 09:49
Location: NYC
Contact:

Postby loqu » 14 Mar 2007 05:01

which mp4box am I using? It's the latest on I found on doom9. (I think.)

I think I remember reading something about the mp4 container being broken in this version of VLC. I don't know if this issue was ever resolved.

I've been pretty frustrated lately about his, because I *know* I had conversion working for all files, except WMV files. Now, I keep running into problems with the h264 codec and conversion. In particular, there was this one Matroska file that I specifically could not convert with the mp4v codec, so I used h264 to convert it, and that is when I started experimenting with h264. I never had a problem until now.

I saw many attempts on doom9 to create a vlc config file that contains the same settings used in MeGUI for the ipod "5.5" profile, but I never saw a completed config file (which would come in handy, since we could just specify that config file when we load vlc by the CLI or GUI.)

... I'll need a couple more days with this, as I've suddenly become busy with "life."

cjk32
New Cone
New Cone
Posts: 1
Joined: 08 Jan 2008 12:23

Re: creating h264 640x480 iPod 5 (v1.2) files

Postby cjk32 » 08 Jan 2008 12:34

I came across this thread whilst having exactly the same issue trying to encode video for playback on an iPhone. The patch below fixed the issue for me, and I can now get mp4info to report the profile as H264 Main, or H264 Baseline by disabling CABAC. For reference, the full command for encoding from a DVD image to an iPhone compatible mp4 is:

$VLC -vvv -I dummy "dvdsimple://$DVDFOLDER@$DVDCHAPTER" --sout "#transcode{vcodec=h264,venc=x264,vb=640,width=480,height=270,deinterlace,acodec=mp4a,ab=128,channels=2}:std{access=file,mux=mp4,dst=\"$OUTFILE\"}" --no-sout-x264-cabac --sout-x264-level 3 vlc:quit

--- vlc-0.8.6d/modules/mux/mp4.c.orig 2007-11-26 13:08:07.000000000 +0000
+++ vlc-0.8.6d/modules/mux/mp4.c 2008-01-08 01:59:50.000000000 +0000
@@ -723,7 +723,7 @@
memcpy( tk->avc.sps, &last[4], i_size );

tk->avc.i_profile = tk->avc.sps[1];
- tk->avc.i_profile = tk->avc.sps[2];
+ tk->avc.i_profile_compat = tk->avc.sps[2];
tk->avc.i_level = tk->avc.sps[3];
}
else if( (last[4]&0x1f) == 8 && tk->avc.i_pps <= 0 ) /* PPS */

dwoodland
New Cone
New Cone
Posts: 1
Joined: 02 Jul 2008 18:42

Re: creating h264 640x480 iPod 5 (v1.2) files

Postby dwoodland » 02 Jul 2008 18:45

Has this issue been fixed in 0.8.6h? If not, will this patch work with this latest version?

I'm interested in converting video for the iPhone using x264 also and I think VLC would be the best option if only I can get this to work.


Return to “VLC stream-output (sout)”

Who is online

Users browsing this forum: No registered users and 10 guests