Difference between revisions of "Bluray"

From Jon's Wiki
Line 24: Line 24:
 
  mplayer 00017.M2TS -dumpaudio -dumpfile 00017.ac3
 
  mplayer 00017.M2TS -dumpaudio -dumpfile 00017.ac3
 
  ffmpeg -i 00017.ac3 -acodec copy -i 00017.vc1 -vcodec libx264 -crf 15 Baraka.mkv
 
  ffmpeg -i 00017.ac3 -acodec copy -i 00017.vc1 -vcodec libx264 -crf 15 Baraka.mkv
 +
 +
;NOTE: With other films, you may need to fiddle about with the mplayer -aid option to get it to fish out the right audio track, otherwise you'll end up with Spanish or something. I suppose that's fine if it's a Spanish film.
  
 
Since Baraka has 102 pixels of letterbox top and bottom, the ffmpeg command is:
 
Since Baraka has 102 pixels of letterbox top and bottom, the ffmpeg command is:

Revision as of 05:17, 28 March 2009

State of play as of March 2009. Hopefully things will improve...

Rip

Currently the only way to rip Bluray discs on a PC is with AnyDVD HD in Windows. In Linux, one can run Windows XP with AnyDVD HD installed in a VM, then share the Bluray drive and mount it with samba in the host. In theory, the mounted share should be the decrypted Bluray disc, as AnyDVD HD should decrypt on the fly. I tried this once and it didn't work.

Transcode

EASY!

Just use tsmuxer - see http://www.smlabs.net/tsmuxer_en.html

Modified MPEG-TS Container

Bluray video is stored in a modified version of the MPEG-TS container format in the BDMV/STREAM folder. The modification is an extra 4 byte time code on each MPEG-TS packet, increasing the packet size from 188 bytes to 192 bytes, apparently in order to better support buffering and out-of-order writing to random-access media. It is unclear whether this is an MPEG Committee sanctioned modification, but there appears to be some standardisation through something called AVCHD. So in theory, a decrypted M2TS file should be sufficient for playback, but most players choke probably due to the modified MPEG-TS format. Currently only mplayer works reliably.

VC-1 Support

Players based on mplayer and ffmpeg 0.5 can decode VC-1. It is more CPU intensive than H264, probably due to code maturity.

Transcode to H264

In this example I'm transcoding my copy of Baraka. If ffmpeg could deal with the M2TS container, I could go

ffmpeg -i 00017.M2TS -acodec copy -vcodec libx264 -crf 15 Baraka.mkv

However since it can't, mplayer comes to the rescue by extracting everything first to eliminate the container from the equation:

mplayer 00017.M2TS -dumpvideo -dumpfile 00017.vc1
mplayer 00017.M2TS -dumpaudio -dumpfile 00017.ac3
ffmpeg -i 00017.ac3 -acodec copy -i 00017.vc1 -vcodec libx264 -crf 15 Baraka.mkv
NOTE
With other films, you may need to fiddle about with the mplayer -aid option to get it to fish out the right audio track, otherwise you'll end up with Spanish or something. I suppose that's fine if it's a Spanish film.

Since Baraka has 102 pixels of letterbox top and bottom, the ffmpeg command is:

ffmpeg -i 00017.ac3 -acodec copy -i 00017.vc1 -vcodec libx264 -crf 15 \
    -croptop 102 -cropbottom 102 -aspect 2.19 Baraka.mkv

H264 Options

See http://ffmpeg.x264.googlepages.com/mapping

Single pass constant rate factor (CRF) is sufficient. Should also use B frames as references, turn trellis encoding on, bump up the motion estimation and subpixel searching methods, and use multiple threads:

ffmpeg -i 00017.ac3 -acodec copy -i 00017.vc1 -vcodec libx264 -crf 15 \
    -croptop 102 -cropbottom 102 -aspect 2.19 \
    -trellis 2 -subq 9 -bf 16 -refs 6 -threads 4 Baraka.mkv