vlc logo

This is a really quick how to:

Using VLC on linux I found a really fast way to remux (mux) a DVD VOBĀ (MPEG2 PS) to an MPEG2 TS (.ts) container for the PS3.

This method simply allows the PS3 to playback the different audio tracks. So for example if your DVD has multiple languages and you want to keep them for playback on the PS3 this is a good method since it doesn’t re-encode or transcode any of the data. All video and audio streams are kept exactly the same as the original. No quality loss.

I am using linux for this but I assume it will work with VLC for any OS:

cvlc input-file.vob :soutĀ file/ts:output-file.ts :sout-all

notes: cvlc is vlc without video display. replace ‘input-file.vob’ with your input file, any file that is mpeg2 PS, eg. .mpeg, .mpg, .vob. replace ‘output-file.ts’ with your choice. The PS3 also recognises .ts, .mts and .m2ts filenames.

As for subtitles these are also muxed into the TS file. However the PS3 does NOT currently recognise subtitles in TS streams. This is something I will experiment with but I don’t think it supported now. Would be nice. If anyone knows how to do this leave a comment. Thanks.

PSP2 concept by 0ffl1n3 (c) 2009

PSP2 concept by 0ffl1n3 (c) 2009

If you want a simple way to create .m3u playlists that will be compatible with the PSP and Sony Ericsson Phones you can create them with a DOS command as follows:

using the CD command, change into the directory containing the music files you want to add to a playlist, eg:

CD “F:\MUSIC\NO LINE ON THE HORIZON”

once in the directory type the following command:

DIR /O:N /B > “NO LINE ON THE HORIZON.m3u”

This will create a file in the directory called “NO LINE ON THE HORIZON.m3u” which will contain a list of all the tracks in this instance in alphabetical order which is useful if the files have track numbers, eg. 01, 02, 03…etc.

The /O:N option sorts the files by name and is optional.

The /B option uses the bare format, ie. no date, file size etc.

At the time of writing this, the PSP only handles a directory depth of one and only handles one .m3u file per folder, and won’t find one in the root directory.

Sony Ericsson phones such as the W850i will allow multiple folder depths and I have not tested dynamic .m3u files outside of the folders containing the music. The folder location is the same as PSP, ie. X:/MUSIC/

You can also use programs such as VideoLAN’s VLC player to export custom .m3uplaylists.

PSP2 Concept

March 7, 2009

Concept models for a PSP2 with folding out gaming ‘arms’. An idea floating… could come with an optional external USB UMD reader/(writer?).

I’ll keep this post simple as I don’t fully understand all of the different flags, however I did thoroughly go through various other posts on the x264 codec and the best flags to use for encoding for PSP.

The results below are designed for creating videos at full 720×480 resolution for the PSP with high quality and not super fast encoding in mind. See my earlier post on Encoding video for the PSP for info on alternative methods.

I used a 2-pass encode, but you can use 1-pass if you don’t feel the need, just remove the “-pass 2” code.

ffmpeg -y -i %1 -s 720x480 -r 25 -an -pass 1 -vcodec libx264 -b 1400kb -bt 2000kb -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -refs 2 -me_method umh -me_range 17 -subq 1 -trellis 0 -coder 1 -bf 7 -b_strategy 1 -threads 0 -g 300 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 %2.mp4

Use the above for the first pass, and the below for the second pass:

ffmpeg -y -i %1 -s 720x480 -r 25 -acodec libfaac -ab 160k -ar 48000 -pass 2 -vcodec libx264 -b 1400kb -bt 2000kb -flags +loop -flags2 +mixed_refs+wpred-fastpskip -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -level 30 -refs 2 -me_method umh -me_range 17 -subq 7 -trellis 2 -coder 1 -bf 7 -b_strategy 1 -threads 0 -g 300 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 %2.mp4

Note: The “-y” option will automatically overwrite the output file if it uses an existing file name, so remove that if you want to be warned about this by ffmpeg. “-y” forces “yes” as an answer.

I wrote a basic .bat batch script for ms-dos/windows automating this a bit, so you only have to type “ffmpegdos input.file output.name”, these are represented by %1 and %2 respectively in the above ffmpeg examples. You can replace %1 with the actual input file name, and %2 with the actual output filename if you want to just run it manually.

The contents of the .bat file are as follows:

@ECHO OFF
echo about to begin encode process...
pause

echo are you sure you wish to overwrite %2.mp4?
pause
D:InstallFFMpegffmpeg -y -i %1 -s 720x480 -r 25 -an -pass 1 -vcodec libx264 -b 1400kb -bt 2000kb -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -refs 2 -me_method umh -me_range 17 -subq 1 -trellis 0 -coder 1 -bf 7 -b_strategy 1 -threads 0 -g 300 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 %2.mp4
D:InstallFFMpegffmpeg -y -i %1 -s 720x480 -r 25 -acodec libfaac -ab 160k -ar 48000 -pass 2 -vcodec libx264 -b 1400kb -bt 2000kb -flags +loop -flags2 +mixed_refs+wpred-fastpskip -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -level 30 -refs 2 -me_method umh -me_range 17 -subq 7 -trellis 2 -coder 1 -bf 7 -b_strategy 1 -threads 0 -g 300 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 %2.mp4
echo DONE!

Just copy paste the above into an empty text file using notepad or similar and save it as ffmpegdos.bat, to run it just open a “Command Prompt” and type ffmpegdos input.file output.name. The .mp4 extension is automatically appended to your output filename.

Good luck!

Encoding video for PSP

December 24, 2008

This is a mostly OS X centric post, but it’s just as relevant for linux and windows as it centres around the use of ffmpeg. (If you want specific ffmpeg info read my other post.)

I recently decided to start using my ancient PSP-1000 to watch my own videos, it usually takes me a long time to actually use gadgets I have to their full potential.

With the practical death of UMD videos and the ~recent introduction of hi-bitrate and hi-resolution mp4 codecs to the PSP and PS3 I thought it was time to give it a go.

BUT I didn’t want to have one set of videos just for the PSP and one set for every other media device. So how to preserve the native resolution and aspect ratio of an original DVD, yet still watch it on the PSP and then still watch it in it’s native DVD resolution as an mp4?

Not easy… It’s taken a lot of searching and 100’s of encodes to figure out some of the optimal settings, and that’s what I’d like to share here. Obviously a lot of credit goes out to all the other people who looked at this before me and found their solutions, cudos.

Firstly, let me clarify that the highest resolution that the PSP handles at the moment is 720 x 480, it does not support PAL native resolutions as far as I can tell.

With this in mind there’s a number of important settings that need to go into encoding AVC (h264/h.264) mp4 video files for the PSP. The most important is that you always need to encode using the MP4 Baseline.

For resolutions like 320×240 or 480×242(native) use the h264 baseline level 1.3 or 2.1 (for ffmpeg this means level=13/level=21).

To encode at 720×480 you can only use h264 baseline level 3.0, nothing else works that I have tried.

Next is something I don’t really get, but the results I suppose speak for themselves. When setting up other codec options, you can only use a maximum of 3 reference frames, and only a maximum of 2 if you are using B frames. However B frames seem to be able to go up to 7 or more so far in my tests, and a combination of 7 B-frames and 2 reference frames rather than 3 reference frames and 0 B-frames seems optimal. See the image below:

picture-2b

You can’t use 8×8 quantize or pyramid B-frames or you’ll break the encode.

Pretty much everything else you can play with.

Now for the more OS X centric part. I’ve found the program HandBrake (version 0.9.1 for OS 10.4.x or higher for 10.5.x) to be excellent.

With this program not only can you encode an mp4 to 720×480 you can also retain the native aspect ratio of the DVD for playback on other devices with a simple check of box.

This means that PAL DVD’s that are squashed into a 720xXXX frame size usually expand to 1024xXXX meaning that you can do that with the 720×480 container, so for instance when I play back the video on my PS3 it plays it back as 1024×480 which looks a lot nicer than squashing it down to 720xXXX. However the PSP will just stretch the video to fill the screen, so if that’s going to be a problem don’t use that option. You can add padding in the crop option to add black borders which will eliminate this, however the final video needs to be exactly 720×480 regardless of the pixel aspect ratio, so keep that in mind.

So in summary, for HandBrake, make sure on the advanced tab that you have:

level=30

as part of your options or your file won’t play on your PSP. (this should work for all ffmpeg encodes too).

Good luck! I may expand the details of this if anyone finds it useful.

(Audio should be AAC 48.000kHz 128kbps, but I think that’s flexible).

Encoding video for VHS

December 24, 2008

the only way to encode for VHS!

First of all you need to find the MPEG-0 codec, which is really hard to find these days due to it being replaced with real codecs.

If you do manage to track down a copy of it, good luck trying to find any software that will recognise it.

Still reading? WTF? Okay load up the software on your Amiga 1000, you’ll need to swap 3.5″ flexi-disks mid way through which will totally corrupt the video file, but somehow you manage it anyway.

Plug your trusty JVC VCR into the custom monitor output on the back of your A1000, note you must have an S-VHS input on the JVC VCR for this to work, or you’ll get too many JPEG artefacts… not worth it IMHO.

Finally, if you have a serial port on your JVC VCR you can hook that up to the Amiga to get it to sync everything nicely and remotely control record and playback functions.

That’s it everything’s looking good so far… fingers crossed. Start the compression of the first frame of video, I think we’re talking about a native VHS resolution of about 300 odd scanlines… plenty, with the onboard memory of the A1000 you should be able to compress one frame per session and using the record/playback sync through the serial port it will pause the tape for you so you can reboot to encode the next frame.

As for the source video file, forget it, you’ll be lucky to get anything digitized in the first place, unless you can find a digi view gold from newtek, even then you’ll probably need 1 meg of chip ram, so go and get your A2000 out.. oh that’s right you left it in the bathroom at that place you rented in Strawberry Hill… oh well, it was fun while it lasted.

I found my thrill on Strawberry Hill

What colour is your berry?