[FFmpeg-user] ffmpeg script
Steve Boyer
steveboyer85 at gmail.com
Thu Feb 8 16:11:16 EET 2018
On Thu, Feb 8, 2018 at 7:13 AM, Shaun Nixon <nixon.shaun73 at gmail.com> wrote:
> thanks, appreciate the help Steve:
> I am at work at present and will try your suggestions when i get home
> tonight; however, does this seem to make sense.
Likewise, at work without access to my Linux boxes. Untested code follows.
>
> Two scripts 1) has the ' *find <directory> -iname '*.ts' -type f -execdir
> /path/to/script.sh "{}" \;*' data and calls script.sh.
> 2) script.sh
>
>
The first would just be a find command. If you wanna script that, that
works too, so you don't have to remember the command. Laziness for the win!
> can i modify script.sh to include multiple '*then*' statements?
> e.g.
>
> script.sh
> #! /bin/bash
> if [ ! -e lock ];
> then touch lock;
> if ffmpeg -y -i "$1" -vf scale=-1:720 -c:v libx264 -crf 23 -preset
> ultrafast -c:a copy $(basename "$i" .ts) "$i.mp4";
>
Heads up - you're mixing $1 (argument 1) with $i (variable i). Should all
be $1 if you were having the find command above find, execute the script
and pass the filename as the argument.
*then*
> * ccextractor "$x" -o "$y".srt *
>
Variables x and y aren't in use. You could probably do something like:
ccextractor "$1" -o "$(basename "$1" .ts).srt"
> then
> rm "$1";
> fi
>
> And honestly, it might just be easier to do a nested "if" statement:
if ffmpeg blah blah blah
then
if ccextractor "$1" -o "$(basename "$1" .ts).srt"
then
rm "$1";
fi
fi
That said, I'm not sure what ccextractor's return codes are. If you are
willing to just throw caution to the wind, could just do:
if ffmpeg blah blah blah
then
ccextractor "$1" -o "$(basename "$1" .ts).srt"
rm "$1";
fi
> is this likely to be a solution that will scan entire multimedia hdd (if i
> put in correct path by find statement) and then ffmpeg the .ts to .mp4 then
> extract closed caption info, then remove the .ts files?
>
> Assuming it doesn't break anything, yes, that's my understanding. I would
comment out (or just leave out alltogether) the "rm" portion until you are
confident you have working the way you like it. Once you rm a file, it'd be
a pain to get it back.
> shaun
Steve
More information about the ffmpeg-user
mailing list