Skip to content

Conversion script for MVC 3D blu ray extracted by MakeMKV

Vargol edited this page May 7, 2020 · 3 revisions

Save this into a script, make it executable and run it using the input file then the output file as parameters.

mkfifo dec_ViewId0000.yuv

mkfifo dec_ViewId0001.yuv

mkfifo sbs.yuv

mkfifo demuxed.h264

INPUT=$1

OUTPUT=$2

FRAMERATE=$(ffprobe -v error -select_streams v:0 -of default=noprint_wrappers=1:nokey=1 -show_entries stream=r_frame_rate $INPUT 2>/dev/null)

FSWIDTH=$(ffprobe -v error -select_streams v:0 -of default=noprint_wrappers=1:nokey=1 -show_entries stream=width -of csv=s=x:p=0 $INPUT 2>/dev/null | head -1)

FSHEIGHT=$(ffprobe -v error -select_streams v:0 -of default=noprint_wrappers=1:nokey=1 -show_entries stream=height -of csv=s=x:p=0 $INPUT 2>/dev/null | head -1)

SBSWIDTH=$(( $FSWIDTH * 2 ))

ffmpeg -y -i $INPUT -f h264 -c:v copy -bsf:v h264_mp4toannexb demuxed.h264 &

sleep 2

ldecod -p DecodeAllLayers=1 -p InputFile=demuxed.h264 -p OutputFile=dec.yuv -p Silent=1 &

sleep 2

yuvsbspipe -w $FSWIDTH -h $FSHEIGHT -n 48 -l dec_ViewId0000.yuv -r dec_ViewId0001.yuv -sbs -o sbs.yuv &

sleep 2

ffmpeg -y -f rawvideo -pixel_format yuv420p -video_size ${SBSWIDTH}x${FSHEIGHT} -framerate $FRAMERATE -i sbs.yuv -i $INPUT -c:v libx265 -crf 24 -map 0:v:0 -c:a aac -map 1:a -map 1:s -c:s copy $OUTPUT

rm dec_ViewId0000.yuv

rm dec_ViewId0001.yuv

rm sbs.yuv

rm demuxed.h264

Clone this wiki locally