Register
It is currently Thu Jul 24, 2014 7:34 pm

Help ffmpeg script


All times are UTC - 6 hours


Post new topic Reply to topic  [ 5 posts ] 
Author Message
 PostPosted: Mon Nov 25, 2013 10:07 am   

Joined: Mon Nov 25, 2013 10:04 am
Posts: 9
Hi all guys,

With this script I can create a new directory with the same name of the file. But I can not put the output of ffmpeg in the newly created directory

Code:
#!/bin/bash
for f in /xxx/*.mov; do
    d="${f%.*}"
    mkdir "$d"
for I in /xxx/*.mov; do ffmpeg -i "$I" -c:a copy -b:v 2000k "${I%.*}".mpg;done
done


i have tried this "$d/${I%.*}".mpg;done but not working

thank you pasaico


Last edited by pasaico on Tue Nov 26, 2013 3:22 am, edited 1 time in total.

Top
 Profile  
 PostPosted: Mon Nov 25, 2013 6:50 pm   

Joined: Mon Mar 02, 2009 3:03 am
Posts: 532
hi,

of course you shouldn't loop twice over /xxx/*.mov

Code:
#!/bin/bash

for f in /xxx/*.mov
do
   d="${f%.*}"
   mkdir "$d"
   ffmpeg -i "$f" -c:a copy -b:v 2000k "$d/${d##*/}.mpg"
done


Top
 Profile  
 PostPosted: Tue Nov 26, 2013 3:21 am   

Joined: Mon Nov 25, 2013 10:04 am
Posts: 9
Watael wrote:
hi,

of course you shouldn't loop twice over /xxx/*.mov

Code:
#!/bin/bash

for f in /xxx/*.mov
do
   d="${f%.*}"
   mkdir "$d"
   ffmpeg -i "$f" -c:a copy -b:v 2000k "$d/${d##*/}.mpg"
done


Oh, thank you very much. WORK FINE!
but What does ##*/
where can I find a small guide to study?


Top
 Profile  
 PostPosted: Tue Nov 26, 2013 7:44 pm   
User avatar

Joined: Wed Jun 08, 2011 8:27 am
Posts: 189
Location: outer Shpongolia
pasaico wrote:
Watael wrote:
hi,

of course you shouldn't loop twice over /xxx/*.mov

Code:
#!/bin/bash

for f in /xxx/*.mov
do
   d="${f%.*}"
   mkdir "$d"
   ffmpeg -i "$f" -c:a copy -b:v 2000k "$d/${d##*/}.mpg"
done


Oh, thank you very much. WORK FINE!
but What does ##*/
where can I find a small guide to study?

In English:

From the beginning of d's pattern resulting from its expansion, seek for the rightmost « / » character's position.
Make the pattern now starts at the index of the first character following the found position.

In other words: while the end of the pattern isn't reached and the current character
isn't the last « / » character present in the pattern, delete the current character.

In other words: delete the longest prefix (« ## ») pattern that matches « / ». (only « # » for the shortest)


The parameter expansion that appears in your first post deletes the shortest suffix (« % ») pattern that matches « . ».


Top
 Profile  
 PostPosted: Tue Dec 10, 2013 6:09 am   

Joined: Mon Nov 25, 2013 10:04 am
Posts: 9
jsz wrote:

In English:

From the beginning of d's pattern resulting from its expansion, seek for the rightmost « / » character's position.
Make the pattern now starts at the index of the first character following the found position.

In other words: while the end of the pattern isn't reached and the current character
isn't the last « / » character present in the pattern, delete the current character.

In other words: delete the longest prefix (« ## ») pattern that matches « / ». (only « # » for the shortest)


The parameter expansion that appears in your first post deletes the shortest suffix (« % ») pattern that matches « . ».


Thank You very much
Your exemples is great.


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP