scripts that i might need later for transcoding
Find a file
2023-07-23 08:58:08 -04:00
audiovideo.md added researchscripts.md 2023-07-23 04:43:14 -04:00
ball.md renamed ball 2023-07-23 08:58:08 -04:00
LICENSE Initial commit 2023-01-02 00:10:13 -05:00
README.md added more black magic 2023-05-05 13:22:23 -04:00
researchscripts.md added researchscripts.md 2023-07-23 04:43:14 -04:00

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'"

dvd unstupiding

for whatever reason av1an doesnt detect the (correct) framerate and it also doesnt detect the aspect ratio. So to fix the framerate add fps=24000/1001 in the -v block. This is also assuming that the original dvd was supported to actualy be at 23.976 fps. You can check this by playing a dvd rip and looking at the estimated framerate. Some dvds are softtelecined ie they got 23.976 frames per second and some are hard telecined where they are 29.97 fps where they got stupid interlaced frames.

to fix the aspect ratio run this command on the transcoded av1 file av1an made

ffmpeg -i Invader\ Zim\ S01E02a.mkv -c copy -aspect 4:3 output.mkv

for whatever other mystical stupid reason the -aspect flag doesnt work in av1an, at least when i tried, so we have to do it after the av1an transcode. and obviously change 4:3 to whatever aspect ratio the dvd normally is. Common aspect ratios, and the only ones that i know of, are 4:3 and 16:9 And even sometimes if you didnt do your cast your druidic ritual spell correctky -aspect wont copy the video over for who knows why so using the command mkvmerge -o outputav1fix.mkv --aspect-ratio 0:16/9 output.mkv might also work. just make sure to change the 0: to the video stream... or just choose random numbers and hope it works.

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