Created
October 7, 2016 14:30
-
-
Save susnux/07c81a8c6d54d894e073dd995a09ac8f to your computer and use it in GitHub Desktop.
playback of FullHD (even cropped FullHD (e.g. 1920x800 per eye)) TAB 3D content with mpv
This file contains 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 | |
# Detect 3D | |
data=$(mkvmerge -F json --identify "$1" | grep "stereo_mode" | grep -Po "\\d") | |
if [ 0$data -eq 3 ]; then | |
echo "TAB left eye first" | |
splitter='lavfi=graph="split [b], crop=h=ih/2:y=0, pad=h=1125:y=(1080-ih)/2:color=black [t]; [b] crop=h=ih/2:y=ih/2, pad=h=1080:y=(1080-ih)/2, [t] vstack"' | |
elif [ 0$data -eq 2 ]; then | |
echo "TAB right eye first" | |
splitter='lavfi=graph="stereo3d=abr:abl, split [b], crop=h=ih/2:y=0, pad=h=1125:y=(1080-ih)/2:color=black [t]; [b] crop=h=ih/2:y=ih/2, pad=h=1080:y=(1080-ih)/2, [t] vstack"' | |
else | |
echo "StereoMode field in matroska not set or not supported format" | |
fi | |
# Change to Frame-Packing screen resolution | |
xrandr --newmode "1920x2205_24" 148.32 1920 2558 2602 2750 2205 2209 2214 2250 +hsync +vsync | |
# Maybe you have to change the HDMI output device | |
xrandr --addmode HDMI-0 "1920x2205_24" | |
xrandr --output HDMI-0 --mode "1920x2205_24" | |
# Play Movie, the hw1,3 is hdmi on my machine | |
mpv -ao=alsa:device="[hw:1,3]" -fs --video-stereo-mode=no -vf "$splitter" "$1" | |
# Reset TV to default vaulue (0x5a is 1920x1080 on my machine, maybe you have to change it) | |
xrandr --output HDMI-0 --mode 0x5a | |
# --mode "1920x1080@60" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment