Last active
March 3, 2024 06:22
-
-
Save rebelancap/5ea25cd2a39f616f78c66189cef6f8dd to your computer and use it in GitHub Desktop.
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
| mkfifo dec_ViewId0000.yuv | |
| mkfifo dec_ViewId0001.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) | |
| 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 | |
| ffmpeg -y -f rawvideo -pixel_format yuv420p -video_size ${FSWIDTH}x${FSHEIGHT} -framerate $FRAMERATE -i dec_ViewId0000.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_left.mp4 & | |
| ffmpeg -y -f rawvideo -pixel_format yuv420p -video_size ${FSWIDTH}x${FSHEIGHT} -framerate $FRAMERATE -i dec_ViewId0001.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_right.mp4 | |
| rm dec_ViewId0000.yuv | |
| rm dec_ViewId0001.yuv | |
| rm demuxed.h264 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment