[FFmpeg-user] ffmpeg script

Carl Zwanzig cpz at tuunq.com
Fri Feb 9 05:38:05 EET 2018


On 2/8/2018 7:27 PM, Shaun Nixon wrote:
> 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 "$1" .ts) "$1.mp4";
^^^^
> then
> ccextractor "$1" -o "$(basename "$1" .ts).srt"
> #rm "$1";
> fi
> fi
> 
> when i run it i think it breaks something as the script stops running and
> goes back to the command prompt or its equivalent in a linux terminal.

It's better to run the command and next look at $? for the return status.
Success status is zero, so "if zero" won't execute the "then" clause, which 
I assume is what you want (run ccextractor if ffmpeg succeeds).
What is $lock used for?
Construct the filenames first into vars, then use those in a command.
(I really dislike bash scripts, btw.)

Doesn't look like any of this is related to ffmpeg, though.

z!




More information about the ffmpeg-user mailing list