AnimeSuki Forums

Register Forum Rules FAQ Members List Social Groups Search Today's Posts Mark Forums Read

Go Back   AnimeSuki Forum > Anime Related Topics > General Anime > Fansub Groups

Notices

Reply
 
Thread Tools
Old 2007-07-25, 23:15   Link #1
Quarkboy
Anime Translator
 
 
Join Date: Nov 2003
Location: Tokyo, Japan
Age: 35
Send a message via AIM to Quarkboy
How to make fansubs playable on the PS3 [firmware 1.90]

Okay, so I recently bought a PS3 with the $100 price drop (and a hefty check from the insurance company I won't get into), and I've been blabbing about how my group's (Arienai)'s fansubs should be playable on the PS3 natively.

Turns out, they are, ALMOST. The only issue is that by default x264 sets the level of the AVC encode to 5.1, even if the settings don't need it to be that high, and the PS3 only plays things that are 4.1 or lower.

So what to do? There is a pretty dang easy solution. Note, I don't take credit for this at all, it was discovered by someone on doom9 (surprise, surprise), however this is a somewhat more lucid writeup.

Here are the steps:

I use x264, mp4box, besweet (for aac audio encoding) and virtualdub's built-in hex editor.

Encode the video to a raw .h264 file using x264 (or me-gui). Don't worry about settings at all, use whatever you see fit. Then, open up the resulting file in your hex editor and look at the very beginning of the file:

At bytes number 5-7, you should have 64 00 33 (assuming you are using high profile and level 5.1). All you need to change is the "33" to a "29", resulting in the number 5-7 bytes being 64 00 29

Then, encode the audio as AAC (LC, although I think that HE might be supported, someone try it out and tell me), mux as normal with mp4box (don't forget the -fps since you are importing raw video), and you have a completely compatible PS3 video file. Load it onto the PS3 and play away.

If you have an already muxed mp4 file, you can do the same trick, but there are _2_ places you have to change 64 00 33 to 64 00 29, both near the beginning of the file, and both very close to each other.


I'm sure someone could write a very simple utility for automating this, but frankly virtualdub's built in hex editor works fine for this purpose.


I've tried this on a number of my own group's fansubs and it works like a charm. The only problem is I don't have a HDTV so I can't play the 1280x720 ones, even though I know they are compatible (it plays them, it just doesn't output the video... it even tells me the currrent video bitrate).
__________________
Yomiuri Television Enterprise
International Media Strategy Chief
Sam Pinansky
Quarkboy is offline   Reply With Quote
Old 2007-07-26, 02:09   Link #2
jfs
Aegisub dev
 
 
Join Date: Sep 2004
Location: Stockholm, Sweden
Age: 30
So what about playing it on the 360? I believe it should also have MPEG-4 AVC support since some time ago.

And what's with the PS3 not displaying 720p videos at all on a non-HDTV? Can't it just downscale?!

Finally, there has to be some way to tell x264 what profile level to write in the bitstream... or push for one to be added.
__________________

Aegisub developer [ Forum | Manual | Feature requests | Bug reports | IRC ]
Don't ask for: More VSFilter changes (I won't), karaoke effects, help in PM's
jfs is offline   Reply With Quote
Old 2007-07-26, 02:18   Link #3
Zero1
Two bit encoder
*Fansubber
 
 
Join Date: Jan 2006
Location: Chesterfield, UK
Age: 30
Quote:
Originally Posted by Zero1
If the file is contained in MP4, search for the string:
61 76 63 43 01

If you have extracted the H.264 to raw, search for the string:
00 00 00 01 67

I believe these are start codes of some sort (I've only really studied hex editing MPEG-2 headers, so this was the result of trial and error).

The next 3 pairs of numbers that follow is the profile and level information. It is written:
Profile N/A Level

So searching an MP4 file may give me:
61 76 63 43 01 64 00 33
We can see that after the string we searched for, we get 64 00 33 , so according to my list below, this gives us High Profile N/A Level 5.1
(N/A just means not applicable, as in there is no information there)


--------------------------------------------------------------------------------

Profiles:
Extended = 58
Baseline = 42
Main = 4D
High = 64
High 10 = 6E
High 4:2:2 = 7A
High 4:4:4 = 90

Levels
1.0 = 0A
1.1 = 0B
1.2 = 0C
1.3 = 0D
2.0 = 14
2.1 = 15
2.2 = 16
3.0 = 1E
3.1 = 1F
3.2 = 20
3.3 = 21
4.0 = 28
4.1 = 29
4.2 = 2A
5.0 = 32
5.1 = 33
I hate the idea of intentionally crippling encodes for dumb H/W limitations. PS3 is supposedly all powerful, so it should handle my encodes if I happened to not set the correct level or whatever (I almost always set the level anyway).

There is a blog or something which Sony seem to be taking note of, I say people should go bitch at them big time.

I also hate the idea of blindly guessing at levels or setting them incorrectly on purpose to trick hardware into playing it. I don't think we want to go down this route and complicate things more than they are compatability/spec wise.
__________________
Zero1 is offline   Reply With Quote
Old 2007-07-26, 02:49   Link #4
Quarkboy
Anime Translator
 
 
Join Date: Nov 2003
Location: Tokyo, Japan
Age: 35
Send a message via AIM to Quarkboy
Quote:
Originally Posted by Zero1 View Post
I hate the idea of intentionally crippling encodes for dumb H/W limitations. PS3 is supposedly all powerful, so it should handle my encodes if I happened to not set the correct level or whatever (I almost always set the level anyway).

There is a blog or something which Sony seem to be taking note of, I say people should go bitch at them big time.

I also hate the idea of blindly guessing at levels or setting them incorrectly on purpose to trick hardware into playing it. I don't think we want to go down this route and complicate things more than they are compatability/spec wise.
Although I agree with you in principle, the fact is I can hardly see any reason to have a FANSUB break high profile 4.1 (in a significant way... w.r.t a previous question I had)... Of course it'd be great if this wasn't necessary and Sony just let the PS3 play whatever it wants, but until then I don't see any reason not to hex edit things when they ARE, indeed, 99% of the time, actually level 4.1 and not level 5.1

I think I'll probably go ahead and do this for all further releases of mine, just for kicks. It definitely doesn't do anything to playback on computers, in any case.

(and me-gui forces me to undo p4x4 if I choose 4.1, which I'd rather not do)
__________________
Yomiuri Television Enterprise
International Media Strategy Chief
Sam Pinansky
Quarkboy is offline   Reply With Quote
Old 2007-07-26, 02:55   Link #5
Quarkboy
Anime Translator
 
 
Join Date: Nov 2003
Location: Tokyo, Japan
Age: 35
Send a message via AIM to Quarkboy
Quote:
Originally Posted by jfs View Post
So what about playing it on the 360? I believe it should also have MPEG-4 AVC support since some time ago.

And what's with the PS3 not displaying 720p videos at all on a non-HDTV? Can't it just downscale?!

Finally, there has to be some way to tell x264 what profile level to write in the bitstream... or push for one to be added.
I don't own a 360, so you go experiment and tell me .

The PS3 doesn't like to downscale, I think. It treated it like a game whose lowest resolution is 720p, so it refused to output the video signal over the 480i composite video hookup. It has nothing to do with the encoding, since the identical 640x360 version plays fine.

Sure, I think you can do it from the start on the command line when encoding (except with the one caveat of using p4x4 search, which is a very technical point that was brought up by me a while ago and frankly, shouldn't be something to worry about in reguards to the playstation 3). This was more a guide for pre-existing encodes that might work even if they weren't set right to begin with. I know that I'll make my encodes say 4.1 from now on personally.
__________________
Yomiuri Television Enterprise
International Media Strategy Chief
Sam Pinansky
Quarkboy is offline   Reply With Quote
Old 2007-07-26, 15:11   Link #6
Zero1
Two bit encoder
*Fansubber
 
 
Join Date: Jan 2006
Location: Chesterfield, UK
Age: 30
Quote:
Originally Posted by Quarkboy View Post
Although I agree with you in principle, the fact is I can hardly see any reason to have a FANSUB break high profile 4.1 (in a significant way... w.r.t a previous question I had)... Of course it'd be great if this wasn't necessary and Sony just let the PS3 play whatever it wants, but until then I don't see any reason not to hex edit things when they ARE, indeed, 99% of the time, actually level 4.1 and not level 5.1

I think I'll probably go ahead and do this for all further releases of mine, just for kicks. It definitely doesn't do anything to playback on computers, in any case.

(and me-gui forces me to undo p4x4 if I choose 4.1, which I'd rather not do)
Actually, I downloaded one of your 720p Pretty Cure encodes to test on the KiSS 1600. It played flawlessly, and by my reckoning, it was a level 5 encode (well I tried re-encoding it with the same settings and using trial and error, x264 kept giving warnings until I reached --level 5).

It's very easy for moderately complex 720p encodes to go beyond 4 or 4.1, a high complexity 720x480 encode can quite easily be level 4 anyway. The thing that tends to push the levels is the amount of reference frames; your encode was pretty much within most restrictions barring the DPB limit.
__________________
Zero1 is offline   Reply With Quote
Old 2007-07-26, 16:50   Link #7
Quarkboy
Anime Translator
 
 
Join Date: Nov 2003
Location: Tokyo, Japan
Age: 35
Send a message via AIM to Quarkboy
Quote:
Originally Posted by Zero1 View Post
Actually, I downloaded one of your 720p Pretty Cure encodes to test on the KiSS 1600. It played flawlessly, and by my reckoning, it was a level 5 encode (well I tried re-encoding it with the same settings and using trial and error, x264 kept giving warnings until I reached --level 5).

It's very easy for moderately complex 720p encodes to go beyond 4 or 4.1, a high complexity 720x480 encode can quite easily be level 4 anyway. The thing that tends to push the levels is the amount of reference frames; your encode was pretty much within most restrictions barring the DPB limit.
I would think that more important to the number of reference frames is the number of b-frames. Since b-frames require up to twice the number of motion vectors as p-frames, and having more of them in a row means higher calculational complexity. The number of reference frames would have more effect on total memory requirements than anything else, right? And I'm not sure how that effects the level specification.
__________________
Yomiuri Television Enterprise
International Media Strategy Chief
Sam Pinansky
Quarkboy is offline   Reply With Quote
Old 2007-07-26, 20:11   Link #8
jfs
Aegisub dev
 
 
Join Date: Sep 2004
Location: Stockholm, Sweden
Age: 30
Now I'm not fully into AVC encoding so some of this is guesswork.

If we say Nr means number of reference frames and Nb is (maximum) number of B-frames then...
Without B-pyramids, a B-frame can reference either the next I/P-frame or the Nr previous I/P-frames. (Or can it reference both Nr frames forwards and Nr backwards?) Ie. it requires memory for at least Nr+1 frames. One (Nr?) of those need to be decoded at least one frame earlier that they are displayed. (Stored order and decoded order of frames is the same. If displayed order is IBP stored order must be IPB because the P-frame is required to decode the B-frame, meaning to display the second frame, two frames must be decoded instead of decoding just one frame per frame displayed.)
With B-pyramid things get much worse. You can have I B1 B2 B3 P and say, B1 and B3 ref I and P but B2 ref I B1 B3 P. So stored order must be I P B1 B3 B2. Even more memory required and even more pre-decoding required.

I hope this post makes sense, I'm really tired atm
__________________

Aegisub developer [ Forum | Manual | Feature requests | Bug reports | IRC ]
Don't ask for: More VSFilter changes (I won't), karaoke effects, help in PM's
jfs is offline   Reply With Quote
Old 2009-02-01, 01:04   Link #9
mickiedaniels
Junior Member
 
Join Date: Jan 2009
This is a very informative topic! Quarkboy, were you able to play fansubs in your PS3 now? Hope it went well!
__________________
Only adults have difficulty with child proof caps.
everquest platinum
mickiedaniels is offline   Reply With Quote
Old 2009-02-01, 02:49   Link #10
sangofe
Senior Member
 
Join Date: Feb 2004
What about this tool?
http://www.bitburners.com/articles/c...-mkv2vob/4022/
sangofe is offline   Reply With Quote
Old 2009-02-01, 05:41   Link #11
windstar!~
C'est la vie...
 
 
Join Date: Oct 2008
Location: Europe
Send a message via MSN to windstar!~
Quote:
Originally Posted by sangofe View Post
Now this also sounds interesting, wonder if it works.
__________________
You can't escape from this nightmare.
windstar!~ is offline   Reply With Quote
Old 2009-02-01, 07:27   Link #12
TGEN
Far out, man!
*Fansubber
 
Join Date: Jul 2008
Age: 30
Odd though: HandBrake's PS3 profile doesn't use B-frames at all, but does pass level=41 to x264. For the X360 it does use B-frames, and passes level=40. It appears to me that they don't know either what exactly is supported. A slightly off-topic question: are all AVC features supported when you put an AVC stream in a (MPEG 2) transport stream to stream it to your PS3?
TGEN is offline   Reply With Quote
Old 2009-02-01, 07:54   Link #13
TheFluff
Excessively jovial fellow
 
 
Join Date: Dec 2005
Location: ISDB-T
Age: 28
Useful and related links regarding how many b-frames/refs you can use if you want hardware compatibility:
http://forum.doom9.org/showthread.php?t=132924
http://www.avsforum.com/avs-vb/showthread.php?t=972503
http://forum.doom9.org/showthread.php?t=140223

Also useful if you (like me) want to figure out how to make your encodes unplayable in hardware players and undecodable with DXVA. :]
__________________
| ffmpegsource
17:43:13 <~deculture> Also, TheFluff, you are so fucking slowpoke.jpg that people think we dropped the DVD's.
17:43:16 <~deculture> nice job, fag!

01:04:41 < Plorkyeran> it was annoying to typeset so it should be annoying to read
TheFluff is offline   Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 04:23.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
We use Silk.