Created
January 20, 2012 23:35
-
-
Save brettle/1650231 to your computer and use it in GitHub Desktop.
Shell script to convert a Nintendo 3DS AVI file to an over-under DLNA-compliant NTSC MPEG-2 program stream (VOB) for viewing on some 3D TVs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Copyright (c) 2012 by Dean Brettle | |
# Licensed under the GPLv3. | |
# To use: | |
# chmod +x 3ds-to-dlna-vob.sh | |
# 3ds-to-dlna-vob.sh yourfile.avi | |
# The horizontal offset between the left and right videos of an object that | |
# should appear on the surface of the screen when viewed in 3D. | |
delta=70 | |
reduced_width=`expr 480 - $delta` | |
display_width=`expr 240 \* 16 / 9` | |
border=`expr $display_width - $reduced_width` | |
border=`expr -1 \* $border / 2` | |
echo "border = $border" | |
base=`basename ${1} .AVI` | |
base=`basename ${base} .avi` | |
gst-launch filesrc location=${1} ! decodebin2 name=decode \ | |
decode.src1 ! queue ! alpha ! videobox left=$delta \ | |
! videobox top=-240 border-alpha=0 \ | |
! videomixer name=mix ! videobox left=$border right=$border \ | |
! ffmpegcolorspace ! gdkpixbufscale ! videorate \ | |
! 'video/x-raw-rgb,width=720,height=480,framerate=30000/1001' \ | |
! ffmpegcolorspace ! mpeg2enc format=9 aspect=3 bitrate=4500 ! mpegpsmux name=mux ! filesink location=${base}.VOB \ | |
decode.src0 ! queue ! alpha ! videobox right=70 ! mix. \ | |
decode.src2 ! queue ! audioconvert ! audioresample ! 'audio/x-raw-int,rate=48000' ! ffenc_mp2 ! mux. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment