Descomente a linha que você deseja usar e o tipo de arquivo. Você pode adicionar muito mais "presets / FLAGS", isso é apenas uma idéia.
sudo nano /media/audio.sh
--- Script para Conversão Recursiva de Video stripping Audio Streams e não convertendo nada!
#!/bin/bash
#Uncomment a Preset FLAGS depending on video/subtitle/audio stream wanting to keep, easy to find which stream via playing in VLC and hitting CTRL + J (when not in fullscreen)
#TO ADD SUBTITLES< THEY MUST BE SAME NAME AS FILE*Check out Filebot Filerenamer*
#Don't Strip audio and do subtitles at the same time, do one at a time
#To add subtitles, just uncomment the line under ADD SUBTITLES
#TO FIX AUDIO SYNC
#Use hotkeys J/K in VLC to find correct value
#DONT use FLAGS, just OFFSET
#FLAGS DESC:
#"-map 0:0 -vcodec copy" -- which video stream to copy
#"-map 0:1 -acodec copy" -- which audio stream to copy
#"-map 0:2 -scodec copy" -- which subtitle stream to copy
#"-itsoffset 0.2" -- DELAY Audio by 0.2 seconds can do -0.2 for opposite effect!
###Video Stream 0 Audio stream 1 Subtitle Stream 2
#export FLAGS="-map 0:0 -vcodec copy -map 0:1 -acodec copy -map 0:2 -scodec copy"
###Video Stream 0 Audio Stream 1
#export FLAGS="-map 0:0 -vcodec copy -map 0:1 -acodec copy"
###Audio Stream 2
#export FLAGS="-map 0:0 -vcodec copy -map 0:2 -acodec copy"
###Audio Stream 3
#export FLAGS="-map 0:0 -vcodec copy -map 0:3 -acodec copy"
##FIX AUDIO SYNC
#export OFFSET="-itsoffset 0.2"
if [ -z "$1" ] ; then
TRANSCODEDIR="."
else
TRANSCODEDIR="$1"
fi
##To remove source files after conversion and rename back to original w/o *FINAL*, uncomment second line #&&find (Must become 1 line of code IE: Hit delete 2 times)
##I do not reccomend using this unless you are 100% of what you are doing, it will delete source files even if conversion fails, basically unless you are creator of files
##ANY files without FINAL will be deleted, be warned, I have personally deleted many a files I didnt want to by using this line :P
##USE ALIASES (and confirm script results) INSTEAD OF &&FIND REMOVE AUTOMATION
#AVI
#find "$TRANSCODEDIR"/* -type f -name "*.avi" -exec bash -c 'ffmpeg -i "$1" $FLAGS "${1%\.*}"FINAL.avi ' __ {} \;
#&& find . -type f -not -name '*FINAL.avi' -name '*.avi' -delete && rename 's/FINAL//' *.avi
#AUDIO SYNC
#find "$TRANSCODEDIR"/* -type f -name "*.avi" -exec bash -c 'ffmpeg -i "$1" $OFFSET -i "$1" -map 0:v -vcodec copy -map 1:a -acodec copy -map 0:s? -scodec copy "${1%\.*}"FINAL.avi ' __ {} \;
#&& find . -type f -not -name '*FINAL.mp4' -name '*.avi' -delete && rename 's/FINAL//' *.avi
#MKV
#FROM ORIGINAL STREAMS
#find "$TRANSCODEDIR"/* -type f -name "*.mkv" -exec bash -c 'ffmpeg -i "$1" $FLAGS "${1%\.*}"FINAL.mkv ' __ {} \;
#&& find . -type f -not -name '*FINAL.mkv' -name '*.mkv' -delete && rename 's/FINAL//' *.mkv
#ADD SUBTITLES
#find "$TRANSCODEDIR"/* -type f -name "*.mkv" -exec bash -c 'ffmpeg -i "$1" -sub_charenc CP1252 -i "${1%\.*}".srt -vcodec copy -acodec copy "${1%\.*}"FINAL.mkv ' __ {} \;
#&& find . -type f -not -name '*FINAL.mkv' -name '*.mkv' -delete && rename 's/FINAL//' *.mkv
#AUDIO SYNC
#find "$TRANSCODEDIR"/* -type f -name "*.mkv" -exec bash -c 'ffmpeg -i "$1" $OFFSET -i "$1" -map 0:v -vcodec copy -map 1:a -acodec copy -map 0:s? -scodec copy "${1%\.*}"FINAL.mkv ' __ {} \;
#&& find . -type f -not -name '*FINAL.mp4' -name '*.mkv' -delete && rename 's/FINAL//' *.mkv
#MP4
#FROM ORIGINAL STREAMS
#find "$TRANSCODEDIR"/* -type f -name "*.mp4" -exec bash -c 'ffmpeg -i "$1" $FLAGS "${1%\.*}"FINAL.mp4 ' __ {} \;
#&& find . -type f -not -name '*FINAL.mp4' -name '*.mp4' -delete && rename 's/FINAL//' *.mp4
#ADD SUBTITLES
#find "$TRANSCODEDIR"/* -type f -name "*.mp4" -exec bash -c 'ffmpeg -i "$1" -f srt -i "${1%\.*}".srt -c:v copy -c:a copy -c:s mov_text "${1%\.*}"FINAL.mp4 ' __ {} \;
#&& find . -type f -not -name '*FINAL.mp4' -name '*.mp4' -delete && rename 's/FINAL//' *.mp4
#AUDIO SYNC
#find "$TRANSCODEDIR"/* -type f -name "*.mp4" -exec bash -c 'ffmpeg -i "$1" $OFFSET -i "$1" -map 0:v -vcodec copy -map 1:a -acodec copy -map 0:s? -scodec copy "${1%\.*}"FINAL.mp4 ' __ {} \;
#&& find . -type f -not -name '*FINAL.mp4' -name '*.mp4' -delete && rename 's/FINAL//' *.mp4
- Alias e automação
sudo nano ~/.bashrc && sudo source ~/.bashrc
alias audioscript="sudo cp /media/audio.sh ./ && sudo nano ./audio.sh ; nohup ./audio.sh > convert.nohup &"
alias mkvfinal="find . -type f -not -name '*FINAL.mkv' -name '*.mkv' -delete && rename 's/FINAL//' *.mkv && find . -name 'audio.sh' -delete && find . -name 'convert.nohup' -delete"
alias avifinal="find . -type f -not -name '*FINAL.avi' -name '*.avi' -delete && rename 's/FINAL//' *.avi && find . -name 'audio.sh' -delete && find . -name 'convert.nohup' -delete"
alias mp4final="find . -type f -not -name '*FINAL.mp4' -name '*.mp4' -delete && rename 's/FINAL//' *.mp4 && find . -name 'audio.sh' -delete && find . -name 'convert.nohup' -delete"
alias srtremove="find . -name '*.srt' -delete"