[FFmpeg-user] ffmpeg script
nixon.shaun73 at gmail.com
Thu Feb 8 02:31:46 EET 2018
i am working on an FFmpeg Bash script in linux.
I am currently using HD Homerun which downloads ,TS files or transport
stream which is a container with an mpeg2 inside with a closed caption
steam for the subtitles. Plex media server will not recognize the closed
caption though VLC will.
my solution to date is to shrink the .ts file using ffmpeg and then extract
the subtitle using ccextract.
at present I run a bash script in each folder containing .ts files, but
would like one I can run from the main directory that would look in all sub
directories find .ts files remux them to mp4, extract the closed caption
stream to .srt and then remove the .ts files.
so far i have the following script. Steven Penny from Stack Exchange
contributed code and i added in the ffmpeg and ccextract lines:
for x in *.ts
y=$(basename "$x" .ts)
ffmpeg -i "$x" -vf scale=-1:720 -c:v libx264 -crf 23 -preset ultrafast
-c:a copy "$y".mp4
ccextractor "$x" -o "$y".srt
This works well if I run it in a directory. I would like to add to it
though and maybe have something like a
Find . -name *.ts
statement or some way for it to look in all folders on multimedia hdd for
.ts files and then do the For Loop but am unsure how.
I also want to add something like
rm /s *.ts
but am unsure if this will work or where to add it after the For Loop.
Would it need a [wait] statement after [done] on the last line.
any advice on writing a bash script that would search for .ts files,
convert them to mp4, and then remove the .ts files would be greatly
More information about the ffmpeg-user