Description: This is just a short service menu script I wrote to batch convert my .flv files to something less proprietary to play in all my players. I searched the internet and didn't find any program for linux that would batch convert flv files with a gui for us converts who are used to it so I figured a service menu would be handy.
As of version 1.1, the approximate file quality menu is geared towards the average quality of typical online downloadable media such as YouTube and Google VIdeo. Also to note, the larger the file size, the more overhead there is, therefore you stray farther away from the original file size when using the 'Closer To Original File Size' option.
Be aware though that when converting closer to the original file quality, it can produce files almost twice as large as the original and that when converting any lossy video to another format, there is always quality loss to some extent whether negligable to us or not.
Also I don't recommend this for multiple large files as there is obviously no GUI to stop it if you accidentally select wrong multiple files other than manually killing the process. That is better done with other video conversion utilities or manually through the shell prompt.
Dependencies: -ffmpeg
Install to /home/yourname/.kde/share/apps/konqueror/servicemenus
If you would like to change the script to convert to a different quality or different file type, here are a few guidelines:
-b bitrate: set the video bitrate in kbit/s (default = 200 kb/s) -ab bitrate: set the audio bitrate in kbit/s (default = 64) -ar sample rate: set the audio samplerate in Hz (default = 44100 Hz) -s size: set frame size. The format is WxH (default 160x12
In the case you do have VLC installed and associated with flv files, you can rename "ServiceTypes=all/all" in the script to "ServiceTypes=video/flv" to keep the submenu from showing up on all file types, otherwise I didn't know a way around it without vlc installed.Last changelog:
1.1.1 - Changed 'Approx Original File Quality' and 'Approx Original File Size' to 'Closer to....' so it doesn't give the impression that the converted file size will be approximate, but closer to it than the file quality option.
1.1.1 - Corrected the %U to %u I mistakenly added in the former upload which made it not do a batch convert.
1.1 - Replaced the three sub-menus with two sub-menus. One to retain the approximate file size of the original and the other to retain the approximate original file quality. The latter version seemed to make larger than necessary files after doing some quality comparison testing. And coincidentally no command options seemed to be needed in the script for ffmpeg to output to the same approx file size.
1.1 - Forced the frame rate to 24fps on the approx quality option since I ran across a few movies for which had non-compliant frame rates and would otherwise not convert. For these movies you will have to choose approximate quality option since upping the frame rate will obviously increase the file size anyway.
1.1 - Added "compare option 1 & 2" just for the heck of it so you can get a comparison of the two in case you're wondering the size and quality difference. It's recommended to only try this on comparatively small files if you're only doing it for a comparison otherwise you may be waiting a while.
make a script named flv2mpg like so:
----------------------
#!/bin/bash -
for i in *.flv
do
echo i
ffmpeg -i $i -ab 56 -ar 44100 -b 500 -s 320x240 $i.mpg
done
-------------------------
then:
yourbox:-$chmod +x flv2mpg
yourbox:-$sudo mv flv2mpg /usr/bin
I use this to download from youtube and google into one folder, then batch convert the flv files and move them over to the mpg folder for storage. Only works if all files are flv in directory. To use it on one file, just cut the main line (ffmpeg -i) and replace i with file.flv. voila.
Hi,
if you associate video/flv with a player which can open flv files (mplayer, xine) in the control center, you needn't to have vlc installed.
Greetings
m0nk
Thanks, but as far as I know, VLC is the only player I know of that can play flv files in Linux. I've tried lots of others. Some would play them but you get no sound.
Ratings & Comments
6 Comments
Very usefull. I'm going to make sure a youtube junkie friend of mine has it. Well done and thank you.
make a script named flv2mpg like so: ---------------------- #!/bin/bash - for i in *.flv do echo i ffmpeg -i $i -ab 56 -ar 44100 -b 500 -s 320x240 $i.mpg done ------------------------- then: yourbox:-$chmod +x flv2mpg yourbox:-$sudo mv flv2mpg /usr/bin I use this to download from youtube and google into one folder, then batch convert the flv files and move them over to the mpg folder for storage. Only works if all files are flv in directory. To use it on one file, just cut the main line (ffmpeg -i) and replace i with file.flv. voila.
Hi, if you associate video/flv with a player which can open flv files (mplayer, xine) in the control center, you needn't to have vlc installed. Greetings m0nk
Thanks, but as far as I know, VLC is the only player I know of that can play flv files in Linux. I've tried lots of others. Some would play them but you get no sound.
mplayer plays them perfectly, xine has problems with sound
kaffiene works, too