Re: [FFmpeg-user] ffmpeg script

2018-02-10 Thread Steve Boyer
On Sat, Feb 10, 2018 at 6:46 AM, Shaun Nixon 
wrote:

> Thanks Steve, you have been superhelpful.
> the find statement works well, it scans looking for .ts files just like I
> wanted.
> I am using the find.sh script you developed to call a seperate script to
> run ffmpeg and then pull closed caption.
> it seems to be working well right now.
> will work on removing those .ts files later on.
>
> i consider this solved and appreciate the help
> -shaun
>
> You're very welcome, glad I was able to help you out!

Steve
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-user] ffmpeg script

2018-02-10 Thread Shaun Nixon
Thanks Steve, you have been superhelpful.
the find statement works well, it scans looking for .ts files just like I
wanted.
I am using the find.sh script you developed to call a seperate script to
run ffmpeg and then pull closed caption.
it seems to be working well right now.
will work on removing those .ts files later on.

i consider this solved and appreciate the help
-shaun

On Fri, Feb 9, 2018 at 12:21 PM, Steve Boyer  wrote:

> On Thu, Feb 8, 2018 at 9:27 PM, Shaun Nixon 
> wrote:
>
> > Hi Steve,
> > so i created 2 scripts:
> >
> > find.sh
> > #! /bin/bash
> > find ~/Plex-Drives/TV/TV/ -iname '*.ts' -type f -execdir
> > ~/Plex-Drives/TV/TV/script.sh "{}" \;
> >
> > 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";
> >
>
> Found problem: you basically call
> if ffmpeg -i ... Output_file_name "Output_file_name.ts.mp4"
> line should read:
> if ffmpeg -y -i "$1" -vf scale=-1:720 -c:v libx264 -crf 23 -preset
> ultrafast -c:a copy "$(basename "$1" .ts).mp4";
>
> So FFmpeg is like "I dunno what kinda output you want me to use!"
>
> then
> > ccextractor "$1" -o "$(basename "$1" .ts).srt"
> > #rm "$1";
> > fi
> > fi
> >
> >
> >
> Steve
> ___
> ffmpeg-user mailing list
> ffmpeg-user@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
>
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-user] ffmpeg script

2018-02-09 Thread Steve Boyer
On Thu, Feb 8, 2018 at 9:27 PM, Shaun Nixon  wrote:

> Hi Steve,
> so i created 2 scripts:
>
> find.sh
> #! /bin/bash
> find ~/Plex-Drives/TV/TV/ -iname '*.ts' -type f -execdir
> ~/Plex-Drives/TV/TV/script.sh "{}" \;
>
> 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";
>

Found problem: you basically call
if ffmpeg -i ... Output_file_name "Output_file_name.ts.mp4"
line should read:
if ffmpeg -y -i "$1" -vf scale=-1:720 -c:v libx264 -crf 23 -preset
ultrafast -c:a copy "$(basename "$1" .ts).mp4";

So FFmpeg is like "I dunno what kinda output you want me to use!"

then
> ccextractor "$1" -o "$(basename "$1" .ts).srt"
> #rm "$1";
> fi
> fi
>
>
>
Steve
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-user] ffmpeg script

2018-02-08 Thread Carl Zwanzig

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!


___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-user] ffmpeg script

2018-02-08 Thread Shaun Nixon
Hi Steve,
so i created 2 scripts:

find.sh
#! /bin/bash
find ~/Plex-Drives/TV/TV/ -iname '*.ts' -type f -execdir
~/Plex-Drives/TV/TV/script.sh "{}" \;

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.
I am stumped.  any ideas


On Thu, Feb 8, 2018 at 9:11 AM, Steve Boyer  wrote:

> On Thu, Feb 8, 2018 at 7:13 AM, Shaun Nixon 
> 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  -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
> ___
> ffmpeg-user mailing list
> ffmpeg-user@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
>
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-user] ffmpeg script

2018-02-08 Thread Shaun Nixon
Thanks again.  Can't wait to get home tonight fire up Mint and try it out.
Good call on #rm for now

On Feb 8, 2018 9:11 AM, "Steve Boyer"  wrote:

> On Thu, Feb 8, 2018 at 7:13 AM, Shaun Nixon 
> 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  -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
> ___
> ffmpeg-user mailing list
> ffmpeg-user@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-user] ffmpeg script

2018-02-08 Thread Steve Boyer
On Thu, Feb 8, 2018 at 7:13 AM, Shaun Nixon  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  -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
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-user] ffmpeg script

2018-02-08 Thread Shaun Nixon
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.

Two scripts  1) has the ' *find  -iname '*.ts' -type f -execdir
/path/to/script.sh "{}" \;*'  data and calls script.sh.
 2) script.sh

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";
*then*
* ccextractor "$x" -o "$y".srt  *
then
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?

shaun


On Wed, Feb 7, 2018 at 10:44 PM, Steve Boyer  wrote:

> On Wed, Feb 7, 2018 at 9:24 PM, Steve Boyer 
> wrote:
>
> >
> > On Feb 7, 2018 6:37 PM, "Shaun Nixon"  wrote:
> >
> > 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:
> >
> > #! /bin/bash
> >  for x in *.ts
> > do
> >   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
> > done
> >
> >
> > 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.
> >
> >
> > Couple of suggestions:
> > 1) tweak the script so it takes in an argument - the .ts file name that
> > does the FFmpeg command and other programs. Generalize it.
> > 2) instead of doing a for loop, do a "find . -iname '*.ts' -type f
> > -execdir scriptname {} \+"
> >
> > This will find all filenames that end (case insensitive) with .ts, and
> > execute your script on it.
> >
> >
> > 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.
> >
> >
> > Another suggestion I've used in the past is FFmpeg returns 0 if
> > successfully. In the script, have the if statement it checks be the
> FFmpeg
> > command. If no problem, it returns 0 (if I recall correctly). Check this
> > value and delete if you want. Give me a bit and I have an automatic DVD
> > creation script I can copy and paste a section from.
> >
>
> NOTE: I'VE NOT EXECUTED THESE TONIGHT - MIGHT NOT WORK OR MIGHT NEED A FEW
> TWEAKS
>
> script.sh:
>
> if [ ! -e lock ];
> then touch lock;
> if ffmpeg -y -i "$1"  $(basename "$i" .ts) "$i.mp4";
> then
> rm "$1";
> fi
>
> Not at that box ATM (pulled script from my github repo), but should be able
> to be invoked via
> find  -iname '*.ts' -type f -execdir /path/to/script.sh "{}" \;
>
> I actually have that running as a crobjob that is ran every second. And the
> "find" command actually ends in \+ for my use, which is really the wrong
> way to do a find -execdir. Is it glamorous? no. Is there better way to
> write it? yes. Have I taken the time to figure out if I can just use the \;
> instead of \+? Nope - it is working, I ain't fixing it.
>
> Steve
>
>
> > 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
> > appreciated.
> >
> > -shaun
> >
> >
> > Steve
> >
> > ___
> > ffmpeg-user mailing list
> > ffmpeg-user@ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-user
> >
> > To unsubscribe, visit link above, or email
> > ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
> >
> >
> >
> ___
> ffmpeg-user mailing list
> ffmpeg-user@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
>
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe,

Re: [FFmpeg-user] ffmpeg script

2018-02-07 Thread Steve Boyer
On Wed, Feb 7, 2018 at 9:24 PM, Steve Boyer  wrote:

>
> On Feb 7, 2018 6:37 PM, "Shaun Nixon"  wrote:
>
> 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:
>
> #! /bin/bash
>  for x in *.ts
> do
>   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
> done
>
>
> 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.
>
>
> Couple of suggestions:
> 1) tweak the script so it takes in an argument - the .ts file name that
> does the FFmpeg command and other programs. Generalize it.
> 2) instead of doing a for loop, do a "find . -iname '*.ts' -type f
> -execdir scriptname {} \+"
>
> This will find all filenames that end (case insensitive) with .ts, and
> execute your script on it.
>
>
> 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.
>
>
> Another suggestion I've used in the past is FFmpeg returns 0 if
> successfully. In the script, have the if statement it checks be the FFmpeg
> command. If no problem, it returns 0 (if I recall correctly). Check this
> value and delete if you want. Give me a bit and I have an automatic DVD
> creation script I can copy and paste a section from.
>

NOTE: I'VE NOT EXECUTED THESE TONIGHT - MIGHT NOT WORK OR MIGHT NEED A FEW
TWEAKS

script.sh:

if [ ! -e lock ];
then touch lock;
if ffmpeg -y -i "$1"  $(basename "$i" .ts) "$i.mp4";
then
rm "$1";
fi

Not at that box ATM (pulled script from my github repo), but should be able
to be invoked via
find  -iname '*.ts' -type f -execdir /path/to/script.sh "{}" \;

I actually have that running as a crobjob that is ran every second. And the
"find" command actually ends in \+ for my use, which is really the wrong
way to do a find -execdir. Is it glamorous? no. Is there better way to
write it? yes. Have I taken the time to figure out if I can just use the \;
instead of \+? Nope - it is working, I ain't fixing it.

Steve


> 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
> appreciated.
>
> -shaun
>
>
> Steve
>
> ___
> ffmpeg-user mailing list
> ffmpeg-user@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
>
>
>
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-user] ffmpeg script

2018-02-07 Thread Steve Boyer
On Feb 7, 2018 6:37 PM, "Shaun Nixon"  wrote:

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:

#! /bin/bash
 for x in *.ts
do
  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
done


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.


Couple of suggestions:
1) tweak the script so it takes in an argument - the .ts file name that
does the FFmpeg command and other programs. Generalize it.
2) instead of doing a for loop, do a "find . -iname '*.ts' -type f -execdir
scriptname {} \+"

This will find all filenames that end (case insensitive) with .ts, and
execute your script on it.


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.


Another suggestion I've used in the past is FFmpeg returns 0 if
successfully. In the script, have the if statement it checks be the FFmpeg
command. If no problem, it returns 0 (if I recall correctly). Check this
value and delete if you want. Give me a bit and I have an automatic DVD
creation script I can copy and paste a section from.


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
appreciated.

-shaun


Steve

___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".