PDA

View Full Version : CAVLC vs CABAC for IPOD vs PSP


frenchskud
30th September 2007, 11:49
Hello,

this post is about the tricky difference between the Ipod and the PSP regarding MPEG-4/AVC coding and especially the CAVLC and CABAC limitations.

If you have both IPOD and PSP then you are strugling to find the right video format to recode your videos... Should you give some good advise trough this post!

Here we go:
The ipod is limited to Baseline Profile Level 3.0 640x480 and we know that we can push files on its HDD upto 720x416 with some program like the famous sharepod.
I find this format very good for encoding DVB files originally coded in 720x576.
Files must be coded in CAVLC

Now the problem is that the recent PSP firmwares are supporting 720x480 (or 480x272) but only for files where the h264 video stream is coded in CABAC mode. :devil:

In addition, the PSP is abble to read CAVLC h264 video stream but only for files coded in Level 1.3 and with a resolution of 320x240. This gives some compatibility with the ipod world but not with the new high resolution ipod generation (aka 5.5G or V1.2 or 1.2.1 ) so we cannot read itunes 640x480 files on the PSP so far, and of course the 720x416 neither....

In addition, we know the PSP is abble to read 480x272 CAVLC files when using the corean homebrew PSPlayerMT, with some jerky...

I ve tried to create MP4 files containing both 480x272 CABAC and then CAVLC stream merged with YAMB, then PSP starts to read the file and just stop sharp when the CAVLC stream is coming.

It is quite clear that SONY did block the CAVLC decoding to avoid ipod-PSP bridges !

Ideally the solution is to hack the PSP firmware to enable 720x416 CAVLC and 640x480 CAVLC but it seems the hacking community is not working on this at the moment.

Another alternative is to write an homebrew based on the famous VLC, able to read CAVLC stream and then to push the flow to the PSP AVC decoder...

Is there any other idea or progress done on ipod-psp compatibility ???

Ranguvar
30th September 2007, 14:57
Unfortunately, I don't believe so.

I agree with you, it sucks. Well, I'd just stick with converting specifically for each device. I use MPEG-4 SP with the iPod just because its AVC support is so terrible and finicky. MPEG-4 SP is super-fast encoding though.

I'll ask around and see if any of the devs I know know how to do this (shouldn't be hard), but don't expect too much.

CruNcher
30th September 2007, 22:22
as the source of the CFW leaked long ago it should be no real problem to circumvent this no (CAVLC) restriction imho.

Ranguvar
1st October 2007, 01:41
Yeah...

But there's no point in making a patch to 3.40 OE when there is 3.71 M33/DAX out now.

One would still have to go through DAX.

Unless you were to write a PRX (plugin), which I know nothing about.

DeathTheSheep
2nd October 2007, 00:06
I have an idea, and a darn good one IMO: stick to 320x240. With good sharp interpolation and a good enough bitrate, it would look almost identical on a screen that small anyway.

Ranguvar
2nd October 2007, 00:18
I have an idea, and a darn good one IMO: stick to 320x240. With good sharp interpolation and a good enough bitrate, it would look almost identical on a screen that small anyway.On the PSP at least, it makes a huge difference, believe me.

Back in the days before PMP Mod (homebrew that allowed playback of MPEG-4 ASP (and later AVC) in the PMP container at any resolution <= 480x272), PSP was limited to 320x240 and 368x208. Even if you use AVC, which was added in 2.00 firmware, it still looked blurry, even after sharpening at 1408kb/s. Luckily, DAX opened up the video support for full-res in 3.03 OE-B/C, and Sony did it themselves in 3.30.

Since the iPod is 320x240 physical, 640x480 on it is actually worse, it introduces jaggies from the point resizing.

Chainmax
2nd October 2007, 03:02
Doesn't CABAC result in better compressibility than CAVLC? If so, why bother with it?

Sagekilla
2nd October 2007, 03:34
Yes CABAC can decrease bitrate by about 15 ~ 20%, the problem though is that it needs more processing power to decode. Not to mention, from the looks of the first post, some odd limitations on both the iPod and PSP as to how you're allowed to use either CAVLC or CABAC. But personally, I don't see this as a detriment to me.. I prefer to encode my video for each environment I view it in, even though that tends to take longer (Tbh, encoding at that low of a resolution and settings, encoding twice doesn't really matter to me) then just sharing it between the iPod and PSP.

frenchskud
2nd October 2007, 09:48
@Ranguvar:
Great if you can put emphasis in the PSP underground team on patching the psp videocodec to turn on CAVLC and extend resolution support to either 640x480 or 720x416 , would be a real enhancement and as we know, Sony would follow this up by giving this possibility in their standard firmware some week later! I ve already given some money to m33 team and noobz trough paypal, I encourage each of the 270 people having read this tread to do it also !

... Also then a great thing would be to derivate the vsh to enable such mp4 files reading from nethost or usbhost, in addition to the VIDEO folder... just dreaming :)

@Sagekilla:
In the meantime you may be right encoding for both environement :)

So at the moment, waiting this feature to be available, I think I m gonna convert all my DVB files into 720x416 or 640x480 CAVLC to ensure 100% compatibility with ipods & iphone, and I ll create a second file in either 368x208 or 320x240 level 1.3 for the PSP (and Archos 404 by the way).

and if I want to display the movies in my volvo car on the famous 9' screens then I just have to copy the hi-res files on the Ipod. And the Archos and PSP are reserved for pure mobile purpose.

According to my experience, a bitrate of 1500k for ipod level3 is rendering verywell on HD ready screens driven by PCHC with CoreAVC, and then 400k should be good enough for the level 1.3 files, especially with 2 pass encoding (+audio bitrate in addition).

Consequence is that I will have 2 files on the PCHC HDD : hi-res Level 3 ones and lo-res Level 1.3, which result in 25% HDD space lost lost but, I can manage this until a famous PSP CFW integrating the ipod compatibility is released! then I ll just have to delete the L1.3 files;

One point then, can someone advise on the right ffmpeg settings especially for pass 1 , if I want to generate the 2 files (L3+L1.3) with ffmeg pass 2 and pass 3 features ... ?

to be more explit, I d like to have a single batch file containing the 3 following lines:

ffmpeg -pass1 "flags to ensure fastest pass 1" -f mp4 tempfile.mp4
ffmpeg -pass2 -level 1.3 "settings for PSP and Ipod lowres -f ipod "lores_psp_ipod_file.m4v"
ffmpeg -pass3 -level 3 "best ipod settings for 1500kb" -f mp4 "hires_ipod_file.mp4"
nicmp4box behing applyied only on "hires_ipod_file.mp4"

:thanks:

frenchskud
2nd October 2007, 10:09
as a complement of the previous post, I just realize that Archos products fully support CABAC and PSP like file (720x480 or 480x272)

So the right balance could be 2 files : L3 CAVLC files ipod compliant 1500kbits + PSP CABAC 480x272 800kbits files, for psp and archos (tested on 404 and 604)

...

Schrade
2nd October 2007, 10:28
Since you're on the subject of PSP Video.. has anyone gotten anamorphic 16:9 video at 720x480 to display full screen on the PSP without having to tell it to use full screen?

It's nice to just have 480x272 show up as "Original" and fill the screen.. it'd be nice to get anamorphic 720x480 16:9 to do the same.

Ranguvar
2nd October 2007, 11:21
@Schrade: Nope... You need to set Full Screen.
@frenchskud: You could use PMP AVC, iR Shell can read those from usbhost and nethost, and PiMP Player can stream them as well. Resolution is limited to 480x272.
@all: The new PSP Slim has TV-Out...
@all: Use XviD4PSP for a good look at what the PSP can do. Very good GUI - AviSynth and x264 based. I recommend 4.115 for now until v5 is more stabke and complete. http://forums.maxconsole.net/showthread.php?t=23305

Schrade
2nd October 2007, 12:05
@all: Use XviD4PSP for a good look at what the PSP can do. Very good GUI - AviSynth and x264 based. I recommend 4.115 for now until v5 is more stabke and complete. http://forums.maxconsole.net/showthread.php?t=23305
I prefer Avidemux :) I just wish I knew enough javascript to do autosizing and stuff so I either do it manually or use their builtin option to do it then edit the rest manually.

It's nice to be able to just load up a file and edit it visually, choosing to copy any streams that don't need reencoding, add filters, etc.

Ranguvar
2nd October 2007, 20:06
I prefer Avidemux :) I just wish I knew enough javascript to do autosizing and stuff so I either do it manually or use their builtin option to do it then edit the rest manually.

It's nice to be able to just load up a file and edit it visually, choosing to copy any streams that don't need reencoding, add filters, etc.Yeah, XviD4PSP *still* doesn't allow Direct Stream Copy for MP3 audio into PSPAVC, even though it does for every other format, and the PSP supports it *scratches head* XviD4PSP does allow you to edit the script and put in custom filters and stuff - just not visually :(

I prefer meGUI or straight CLI for encodes that I will use for a long time, I just use XviD4PSP for quick'n'dirty batches of encodes - like an anime series ;)

frenchskud
4th October 2007, 12:54
Hello,

some interresting news, after some tests...

I love x264 format, but this morning I ve tried the xvid+aac embded in the mp4 container.

the psp normally accept only 320x240 or 368x208.
But I ve tried other combinaison which works verywell, as far as the total number of pixels is below or equal to 100096.
I think this statement is new in the PSP world.

Practically, 368x272 and 416x240 are working verywell.
I ve then pushed the files on ipod and Archos and the result is excellent :)

So MPEG4-SP is a good trade off for portability !
for 4:3 video choose 368x272.
For 16:9 video choose 416x240 unless you prefer to have 272 real lines and extend the psp screen horizontally. need to check what is the best.

example of very basic ffmpeg settings that works on the 3 devices:

ffmpeg -y -i test.mpg -codec xvid -b 768 -s 368x272 -f mp4 test.mp4

here we go!

Ranguvar
4th October 2007, 20:05
Hello,

some interresting news, after some tests...

I love x264 format, but this morning I ve tried the xvid+aac embded in the mp4 container.

the psp normally accept only 320x240 or 368x208.
But I ve tried other combinaison which works verywell, as far as the total number of pixels is below or equal to 100096.
I think this statement is new in the PSP world.

Practically, 368x272 and 416x240 are working verywell.
I ve then pushed the files on ipod and Archos and the result is excellent :)

So MPEG4-SP is a good trade off for portability !
for 4:3 video choose 368x272.
For 16:9 video choose 416x240 unless you prefer to have 272 real lines and extend the psp screen horizontally. need to check what is the best.

example of very basic ffmpeg settings that works on the 3 devices:

ffmpeg -y -i test.mpg -codec xvid -b 768 -s 368x272 -f mp4 test.mp4

here we go!Yep, MPEG-4 SP works.

Although I guess I did get the supported resolutions wrong.


I'm definitely gonna stick with my 480x272 AVC encodes though, with a separate MPEG-4 SP for the iPod. MPEG-4 SP is so fast, it's not really worth dragging the PSP down with it.

What firmware did you test with? 3.30 opens up almost all resolutions <= 480x272 for AVC, not sure wether it does the same for SP. Maybe Dark_AleX's hack in 3.03 OE-B/C did it too, I've only tested it with AVC...