[opensuse] Bulk converting *.flv files to *.mp3
My wife has accumulated quite a number of *.flv files which need converting to *.mp3 so that they may be played on an mp3 device. I know that VLC will do such a conversion but having to convert some 200 files individually is not my idea of how I want to spend Sunday afternoons :-( . I have checked the 'net and came across a couple of suggestions on how to batch-process these files using ffmpeg- but they don't work in all cases, they convert some of the files but not all for some reason. Does anyone, please, know of a reliable method of how a batch convert from *.flv to *.mp3 can be done? (There are also some files which are *.avi and *.wav but I guess that I can use the slow method of doing them with VLC - but if there is a faster way.......?) BC -- Using openSUSE 13.1, KDE 4.11.2 & kernel 3.12.0-1 on a system with- AMD FX 8-core 3.6/4.2GHz processor 16GB PC14900/1866MHz Quad Channel Corsair "Vengeance" RAM Gigabyte AMD3+ m/board; Gigabyte nVidia GTX660 OC 2GB DDR5 GPU -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Le 13/11/2013 14:24, Basil Chupin a écrit :
Does anyone, please, know of a reliable method of how a batch convert from *.flv to *.mp3 can be done?
ffmpeg in a batch loop jdd -- http://www.dodin.org -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Le 13/11/2013 14:32, jdd a écrit :
Le 13/11/2013 14:24, Basil Chupin a écrit :
Does anyone, please, know of a reliable method of how a batch convert from *.flv to *.mp3 can be done?
ffmpeg in a batch loop
jdd
just tested: ffmpeg -i video file.flv test.mp3 do the job but you may want to have other set ups than default jdd -- http://www.dodin.org -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On November 13, 2013 at 2:24 PM Basil Chupin
wrote: My wife has accumulated quite a number of *.flv files which need converting to *.mp3 so that they may be played on an mp3 device. I know that VLC will do such a conversion but having to convert some 200 files individually is not my idea of how I want to spend Sunday afternoons :-( .
vlc has so many command line options - I'm pretty sure that such a batch conversion can be done with it. Maybe you have to wrap it into some shell code like: $ find . -type f -name '*.flv' \ while read FLV ; do vlc -some --opt -ion --out="${FLV%.flv}.mp3" "$FLV" ; \ done The options are not the real ones, just as an example. (This loop assumes that you don't have any 'very-special' file names, of course). Just dive into the manual. Have a nice day, Berny -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On Thu, 14 Nov 2013 00:24:14 +1100 Basil Chupin wrote: > My wife has accumulated quite a number of *.flv files which need > converting to *.mp3 so that they may be played on an mp3 device. I > know that VLC will do such a conversion but having to convert some > 200 files individually is not my idea of how I want to spend Sunday > afternoons :-( . > > I have checked the 'net and came across a couple of suggestions on > how to batch-process these files using ffmpeg- but they don't work in > all cases, they convert some of the files but not all for some reason. > > Does anyone, please, know of a reliable method of how a batch convert > from *.flv to *.mp3 can be done? > > (There are also some files which are *.avi and *.wav but I guess that > I can use the slow method of doing them with VLC - but if there is a > faster way.......?) > > BC > Hi Basil, You've already been given the basics but I've done enough of this that I simply can't _not_ throw in my 2 cents. Below is the simple looping script that I use. YMMV depending upon your hardware but I always set it up to read the source from one physical drive while writing to another ... it's faster and less stress on the drives. - - - - - 8< - - - - - > #!/bin/bash > # for all .flv files, extract .mp3 audio content > FILES="*.flv" > # for loop read each file > for f in $FILES > do > INF="$f" > OUTF="/TARGET/PATH/$f.mp3" > ffmpeg -i $INF $OUTF > done - - - - - 8< - - - - - common ffmpeg audio options: `-ar freq' Set the audio sampling frequency (default = 44100 Hz). `-ab bitrate' Set the audio bitrate in bit/s (default = 64k). `-ac channels' Set the number of audio channels. For input streams it is set by default to 1, for output streams it is set by default to the same number of audio channels in input. If the input file has audio streams with different channel count, the behaviour is undefined. e.g. ffmpeg -i somefile.flv -ar 44100 -ab 64k -ac 2 /path/somefile.mp3 hth & regards, Carl -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 14/11/13 12:43, Carl Hartung wrote: > On Thu, 14 Nov 2013 00:24:14 +1100 > Basil Chupin wrote: > >> My wife has accumulated quite a number of *.flv files which need >> converting to *.mp3 so that they may be played on an mp3 device. I >> know that VLC will do such a conversion but having to convert some >> 200 files individually is not my idea of how I want to spend Sunday >> afternoons :-( . >> >> I have checked the 'net and came across a couple of suggestions on >> how to batch-process these files using ffmpeg- but they don't work in >> all cases, they convert some of the files but not all for some reason. >> >> Does anyone, please, know of a reliable method of how a batch convert >> from *.flv to *.mp3 can be done? >> >> (There are also some files which are *.avi and *.wav but I guess that >> I can use the slow method of doing them with VLC - but if there is a >> faster way.......?) >> >> BC >> > Hi Basil, > > You've already been given the basics but I've done enough of this that I > simply can't _not_ throw in my 2 cents. > > Below is the simple looping script that I use. YMMV depending upon your > hardware but I always set it up to read the source from one physical > drive while writing to another ... it's faster and less stress on the > drives. > > - - - - - 8< - - - - - >> #!/bin/bash >> # for all .flv files, extract .mp3 audio content >> FILES="*.flv" >> # for loop read each file >> for f in $FILES >> do >> INF="$f" >> OUTF="/TARGET/PATH/$f.mp3" >> ffmpeg -i $INF $OUTF >> done > - - - - - 8< - - - - - > > common ffmpeg audio options: > > `-ar freq' > Set the audio sampling frequency (default = 44100 Hz). > > `-ab bitrate' > Set the audio bitrate in bit/s (default = 64k). > > `-ac channels' > Set the number of audio channels. For input streams it is set by > default to 1, for output streams it is set by default to the same > number of audio channels in input. If the input file has audio > streams with different channel count, the behaviour is undefined. > > e.g. ffmpeg -i somefile.flv -ar 44100 -ab 64k -ac 2 /path/somefile.mp3 > > hth & regards, > > Carl Many thanks for this, Carl! Something which works! But with qualifications. I cried and gnashed my teeth because the above failed to work - until I decided to try it in oS 12.3 and not the 13.1 I have been using for quite some time. In 12.3 the above works - in 13.1 it doesn't: all generated files have 0 bytes. But even in 12.3 there is a vital requirement: the file names cannot have blank spaces in them. That is, Men At Work will not be processed (No such file or directory) but Men_At_Work, for example, will get converted. And lastly, but not a show-stopper, is that '.mp3' is appended to the name of the .flv file so that the new name comes out as Men_At_Work.flv.mp3. Thanks again for the above script. (And now to go thru ~200 files and rename them not to have any blanks in their name :-) .) BC -- Using openSUSE 13.1, KDE 4.11.2 & kernel 3.12.0-1 on a system with- AMD FX 8-core 3.6/4.2GHz processor 16GB PC14900/1866MHz Quad Channel Corsair "Vengeance" RAM Gigabyte AMD3+ m/board; Gigabyte nVidia GTX660 OC 2GB DDR5 GPU -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Basil, et al -- ...and then Basil Chupin said... % % On 14/11/13 12:43, Carl Hartung wrote: ... % > % >Below is the simple looping script that I use. YMMV depending upon your % >hardware but I always set it up to read the source from one physical % >drive while writing to another ... it's faster and less stress on the % >drives. % > % >- - - - - 8< - - - - - % >>#!/bin/bash % >># for all .flv files, extract .mp3 audio content % >>FILES="*.flv" % >># for loop read each file % >>for f in $FILES % >>do % >>INF="$f" % >>OUTF="/TARGET/PATH/$f.mp3" Change this line to BASE=`basename "$F" .flv` OUTF="/TARGET/PATH/$BASE.mp3" % >>ffmpeg -i $INF $OUTF Change this line to ffmpeg -i "$INF" "$OUTF" ... % % Many thanks for this, Carl! Something which works! But with qualifications. You should always season to taste :-) % ... % But even in 12.3 there is a vital requirement: the file names cannot % have blank spaces in them. That is, Men At Work will not be processed % (No such file or directory) but Men_At_Work, for example, will get % converted. Aside from the fact that BlanksAreEvil, just quote them. See the second change above. % % And lastly, but not a show-stopper, is that '.mp3' is appended to the % name of the .flv file so that the new name comes out as Men_At_Work.flv.mp3. You just need to strip off the old extension before adding the new. See the first changes above. Admittedly, one might care what source was used to make what MP3 file, so leaving the .flv in could be good, but it's also easy to strip if you wish. % % Thanks again for the above script. % % (And now to go thru ~200 files and rename them not to have any blanks in % their name :-) .) While I of course love that, realistically you needn't. % % BC HTH & HAND :-D -- David T-G See http://justpickone.org/davidtg/email/ See http://justpickone.org/davidtg/tofu.txt
Hallo Basil, op 14-11-13 12:00 schreef je:
(And now to go thru ~200 files and rename them not to have any blanks in their name :-) .)
Maybe a script could be useful: http://www.tekstbaken.nl/efkus/spacereplace.zip Harrie -- Harrie Baken | Tekstbureau TekstBaken Copy-editing - proofreading - seo http://www.tekstbaken.nl/ Registered Linux user #366560 | openSUSE 12.3 -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Hi again, all -- ...and then Harrie Baken said... % % Maybe a script could be useful: % http://www.tekstbaken.nl/efkus/spacereplace.zip WOW. That's quite a piece of work! And here I always just do that sort of thing with a find(1) oneliner :-) I admit, though, that it's a bit trickier without -print0, and I bet that wasn't yet typical back in 2005. % % Harrie HAND :-D -- David T-G See http://justpickone.org/davidtg/email/ See http://justpickone.org/davidtg/tofu.txt
Le 14/11/2013 12:00, Basil Chupin a écrit :
(And now to go thru ~200 files and rename them not to have any blanks in their name :-) .)
in my pohoto workflow, I have this step: I name this script: normalize-randomizez-photo.sh. detox is easy to find. Last part changes JPG to jpg and then add a ramdom part (to prevent robots from taking all my shots in a go) you can do the same for any file #!/bin/sh # usage: se placer dans le répertoire #lancer "sh normalize-randomizez-photo.sh" #On se retrouve avec les fichiers anonymisés et normalisés detox -s utf_8 * for I in *.jpeg ; do rename -- "jpeg" "jpg" $I ; done for I in *.JPG ; do rename -- "JPG" "jpg" $I ; done for I in *.jpg ; do ran=-$RANDOM ; rename -- "." "$ran." $I done I have also a "mp4tomp3 script (good for any video) that adress your exptension file problem: #!/bin/bash # echo usage: movtodvd.sh *.MOV for a ; do b=`echo "$a" | cut -d'.' -f1` ; ffmpeg -i $a -ar 44100 -ab 192k $b.mp3 ; done exit jdd -- http://www.dodin.org -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On Thu, 14 Nov 2013 22:00:53 +1100 Basil Chupin wrote:> > Many thanks for this, Carl! You're welcome! > Something which works! But with qualifications. > > I cried and gnashed my teeth because the above failed to work - until > I decided to try it in oS 12.3 and not the 13.1 I have been using for > quite some time. > > In 12.3 the above works - in 13.1 it doesn't: all generated files > have 0 bytes. I've only relatively recently completely tamed 12.3 here. I need to restrain myself because it's my workhorse. :-) You're probably still taming 13.1 there. Give it time. ;-) > But even in 12.3 there is a vital requirement: the file names cannot > have blank spaces in them. That is, Men At Work will not be processed > (No such file or directory) but Men_At_Work, for example, will get > converted. I don't do file names with spaces in them. :-) Sorry I forgot about that scenario. It was late... > And lastly, but not a show-stopper, is that '.mp3' is appended to the > name of the .flv file so that the new name comes out as > Men_At_Work.flv.mp3. > > Thanks again for the above script. > > (And now to go thru ~200 files and rename them not to have any blanks > in their name :-) .) Here's the solution I found for the *.flv.mp3 --> .mp3 problem. You certainly don't need to do this job by hand! Place it in your ~/bin, (chmod it you already know) and invoke it in the directory with the offending double extensions. - - - - - 8< - - - - - > #!/bin/bash > # rfe.sh: Renaming file extensions. > # > # rfe old_extension new_extension > # > # Example: > # To rename all *.gif files in working directory to *.jpg, > # rfe gif jpg > > > E_BADARGS=65 > > case $# in > 0|1) # The vertical bar means "or" in this context. > echo "Usage: `basename $0` old_file_suffix new_file_suffix" > exit $E_BADARGS # If 0 or 1 arg, then bail out. > ;; > esac > > > for filename in *.$1 > # Traverse list of files ending with 1st argument. > do > mv $filename ${filename%$1}$2 > # Strip off part of filename matching 1st argument, > #+ then append 2nd argument. > done > > exit 0 - - - - - 8< - - - - - regards, Carl -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 15/11/13 00:34, Carl Hartung wrote: > On Thu, 14 Nov 2013 22:00:53 +1100 > Basil Chupin wrote: > >>> Many thanks for this, Carl! > You're welcome! > >> Something which works! But with qualifications. >> >> I cried and gnashed my teeth because the above failed to work - until >> I decided to try it in oS 12.3 and not the 13.1 I have been using for >> quite some time. >> >> In 12.3 the above works - in 13.1 it doesn't: all generated files >> have 0 bytes. > I've only relatively recently completely tamed 12.3 here. I need to > restrain myself because it's my workhorse. :-) You're probably still > taming 13.1 there. Give it time. ;-) > >> But even in 12.3 there is a vital requirement: the file names cannot >> have blank spaces in them. That is, Men At Work will not be processed >> (No such file or directory) but Men_At_Work, for example, will get >> converted. > I don't do file names with spaces in them. :-) Sorry I forgot about > that scenario. It was late... > >> And lastly, but not a show-stopper, is that '.mp3' is appended to the >> name of the .flv file so that the new name comes out as >> Men_At_Work.flv.mp3. >> >> Thanks again for the above script. >> >> (And now to go thru ~200 files and rename them not to have any blanks >> in their name :-) .) > Here's the solution I found for the *.flv.mp3 --> .mp3 problem. You > certainly don't need to do this job by hand! Place it in your ~/bin, > (chmod it you already know) and invoke it in the directory with the > offending double extensions. > > - - - - - 8< - - - - - >> #!/bin/bash >> # rfe.sh: Renaming file extensions. >> # >> # rfe old_extension new_extension >> # >> # Example: >> # To rename all *.gif files in working directory to *.jpg, >> # rfe gif jpg >> >> >> E_BADARGS=65 >> >> case $# in >> 0|1) # The vertical bar means "or" in this context. >> echo "Usage: `basename $0` old_file_suffix new_file_suffix" >> exit $E_BADARGS # If 0 or 1 arg, then bail out. >> ;; >> esac >> >> >> for filename in *.$1 >> # Traverse list of files ending with 1st argument. >> do >> mv $filename ${filename%$1}$2 >> # Strip off part of filename matching 1st argument, >> #+ then append 2nd argument. >> done >> >> exit 0 > - - - - - 8< - - - - - > > regards, > > Carl Thank you to everyone who provided me with help re this. I will reply later but at the moment I have other matters pressing on me. But I just have to say that the bunch of knowledgeable guys on this list is phenomenal and unequalled on any other list I have been on. BC -- Using openSUSE 13.1, KDE 4.11.3 & kernel 3.12.0-1 on a system with- AMD FX 8-core 3.6/4.2GHz processor 16GB PC14900/1866MHz Quad Channel Corsair "Vengeance" RAM Gigabyte AMD3+ m/board; Gigabyte nVidia GTX660 OC 2GB DDR5 GPU -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 11/15/2013 01:47 AM, Basil Chupin wrote:
On 15/11/13 00:34, Carl Hartung wrote:
On Thu, 14 Nov 2013 22:00:53 +1100 Basil Chupin wrote:
<snipped>
Many thanks for this, Carl! You're welcome!
Something which works! But with qualifications.
I cried and gnashed my teeth because the above failed to work - until I decided to try it in oS 12.3 and not the 13.1 I have been using for quite some time.
In 12.3 the above works - in 13.1 it doesn't: all generated files have 0 bytes. I've only relatively recently completely tamed 12.3 here. I need to restrain myself because it's my workhorse. :-) You're probably still taming 13.1 there. Give it time. ;-)
But even in 12.3 there is a vital requirement: the file names cannot have blank spaces in them. That is, Men At Work will not be processed (No such file or directory) but Men_At_Work, for example, will get converted. I don't do file names with spaces in them. :-) Sorry I forgot about that scenario. It was late...
/snip/
If you need to use a file that has spaces in it, you can do so by "escaping" the space, like this: Men at Work becomes Men\ at\ Work That may not be of any help to you, but you should be aware of it. It works throughout any Linux system wherever there's a file name with a space and you need to do something with it. The escape sequence (back-slant, then the character) is useful if you have a name with an apostrophe in it, or any keyboard character that Linux wouldn't ordinarily like. I think it works across Unix also, but I'm not certain. It should certainly work in the Bourne shell, as it works in the Bourne Again SHell--bash. --doug -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
participants (7)
-
Basil Chupin
-
Bernhard Voelker
-
Carl Hartung
-
David T-G
-
Doug
-
Harrie Baken
-
jdd