my HD Homerun for PLEX saves .TS files (transport stream).
in order to shrink this to 720 i use the following script:
#!/bin/bash for INF in *.ts do ffmpeg -i "$INF" -vf scale=-1:720 -c:v libx264 -crf 23 -preset ultrafast -c:a copy "${INF%.*}.mp4" done
this works well and converts every .TS in folder .sh script is stored in to an mp4 container. I then run the following script:
#!/usr/local/bin/bash for INF in *.mp4 do echo "Extracting subtitles" ccextractor "$INF" -o "/tmp/$(basename "$INF" .ts).srt" echo "Moving subtitles" mv -v /tmp/*.srt . done
My goal is combine both these bash loops into one script. Ideally i would like, one script that will: a) scan current folder and all sub-folders looking for .ts files. b) remux .ts to .mp4 c) pull closed captions out of .ts and store as .srt d) remove all .ts files
I am not sure I added a / after 'for INF in *.ts' would include sub-directories. and not sure how to join these two scripts into one file or where to put the remove file(s) code
any ideas would be greatly appreciated. -shaun