zombie_transcoding_scripts/README.md
2023-01-02 20:06:15 -05:00

2.9 KiB

zombie_transcoding_scripts

scripts that i might need later for transcoding

Common Transcoding commands

penis

Transcode input to av1 and transcode the audio aswell (used for teen titans)

#!/bin/bash
#script written by logan but typed by zombie
#optimezed for teentitans
for i in *mkv; do
	av1an -i "$i" -o av1/"$(basename "$i")" -e aom -c mkvmerge --passes=2 -v "--threads=2 --cpu-used=5 --end-usage=q --cq-level=24 --enable-fwd-kf=1 --aq-mode=1 --lag-in-frames=48 --bit-depth=10 --kf-max-dist=240 --kf-min-dist=12 --enable-qm=1 --sb-size=64 --enable-keyframe-filtering=2 --arnr-strength=2 --arnr-maxframes=3 --sharpness=1 --enable-dnl-denoising=0 --denoise-noise-level=5" -a "-c:a libopus -b:a:0 128k -af aformat=channel_layouts='7.1|5.1|stereo'" --chunk-order random -m lsmash -r
done

For the file in question, all audio tracks will be transcoded. It may be useful to delete unnecessary tracks before transcoding. For example, in the case of Teen Titans, there was a lossless and a lossy track. I wanted to keep just the lossless track so i did:

for i in *mkv; do mkvmerge -o "$(basename "$i").balls" --audio-tracks 1 "$i"; done

to delete the unwanted tracks you can use the mkvinfo command to get the track you want to remove

this one doesnt transcode the audio

#!/bin/bash
#script written by logan but typed by zombie

for i in *mkv; do
	av1an -i "$i" -o av1/"$(basename "$i")" -e aom -c mkvmerge --passes=2 -v "--threads=2 --cpu-used=5 --end-usage=q --cq-level=24 --enable-fwd-kf=1 --aq-mode=1 --lag-in-frames=48 --bit-depth=10 --kf-max-dist=240 --kf-min-dist=12 --enable-qm=1 --sb-size=64 --enable-keyframe-filtering=2 --arnr-strength=2 --arnr-maxframes=3 --sharpness=1 --enable-dnl-denoising=0 --denoise-noise-level=5" --chunk-order random -m lsmash -r
done

the only difference between the one that does the audio and the one that doesnt is -a "-c:a libopus -b:a:0 128k -af aformat=channel_layouts='7.1|5.1|stereo'"

Transcode input to h264 and not audio (classic zombie crap version for playing on phone)

# create the h264 directory if it doesn't already exist
mkdir -p h264

# loop through all .mkv files in the current directory
for file in *.mkv; do
  # run the ffmpeg command on the current file
  ffmpeg -i "$file" -s 960x540 -c:v libx264 -preset veryslow -crf 30 -c:a copy "h264/${file%.*}.mkv"
done

single file version

ffmpeg -i Teen\ Titans\ S04E11.mkv -s 960x540 -c:v libx264 -preset veryslow -crf 30 -c:a copy output540pveryslow30ep11kleiner.mkv

Common info commands

this gets the info of all the audio of the videos in the current dir and displays it neatly (is useful for finding problems with the audio)

for i in *.mkv; do mediainfo "$i" | grep -e "Complete name" -e "Video" -e "Audio" -e "channels" -e "Bit rate"; echo "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=";  done