
Source (link to git-repo or to original if based on someone elses unmodified work): Add the source-code for this project on opencode.net
Right-click on a file, and this script will decide what conversions are appropriate, ask some questions about what you want, and execute the proper command and options to convert it into something else.
Multimedia: change formats, bitrate, framerate, size, aspect ratio, and more. Also strip audio.
Audio: change formats, bitrate, volume, and more.
Multimedia and Audio: your most-used sets of options can be stored for future use.
Images: change formats, size, jpg compression, rotate, equalize, and more.
Documents: change formats, text-to-speech, text-to-jpg, and more.
Convert multi-image files, like pdf or animated gif, into a series of frames,
pdf to gif creates animaged gif, animated gif to pdf creates multi-page pdf.
Convert various "CD Images" into standard .iso files.
[li]Comments welcome, suggestions invited, votes appreciated.[/li]
There's a lot of description here, but you don't need any of it to make this work.
Just download and extract. Then do one or more of these with the file "avconvert":
(1) move (or copy or link) it to ~/.gnome2/nautilus-scripts
(2) move (or copy or link) it to somewhere in $PATH (eg /usr/local/bin)
..(obviously don't move it twice :-)
(3) do #2, then add it as a nautilus-action (The Command "Parameters" must be "space-separated list of selected filenames", and "Working Directory" must be "first base directory". On Fedora, these are %F and %d)
(4) add it to Gnome panel/launch-bar (drag/drop or right-click panel Add/Custom-Application)
...Depending on 1, 2, 3, and 4 above (you can do any combination of these), you can now:
(1) right-click on selected icon(s) and choose the script
(2) from command line: avconvert filename (quote name(s) with spaces, multiple files OK)
(3) right-click on selected icon(s) and choose "Avconvert"
(4) click the icon to launch -or- drag-and-drop file(s) on the icon
To repeat, you can do as many of these as you want. For example: move the file to ~/.gnome2/natuilus-scripts, then link that to /usr/local/bin, then add it as a nautilus-action, then add it to the gnome-panel.
Much more than a quick shortcut to a common command, this shell script is over 2000 lines of code!
[li]If you feel inclined not to vote "good", tell me why - I'm still actively developing this.
If you like it and you're not registered, take the time to sign up and vote....
After all, I took the time to write this and give it away! :-) :-)
If this has become a tool you use regularly, PLEASE consider a small donation
A lot of time and effort has gone into bringing this to the "free" world
[/li]
The first run will create some files in ~/.config/avconvert. The files "avconvert", "avconvert.lang", and "avconvert.ffopts.custom" may be hand-edited. A default file will be recreated if any file is missing.
When using Key-In-Options during audio or video conversion, your ffmpeg options can be saved into the menu for future use. When your Key-In options end in a comment (as in "# my conversion"), a line will be automatically added to the 'custom' section of the ffmpeg options menu.
There's a progress indicator during conversions. In most cases, it estimates that the result file will grow to the size of the source file. This is not always the case because depending on the conversion the result may be larger or smaller than the original, so it may only reach 25-30% and be finished or quickly rise to 98% and hover there depending on your conversion. Be patient - behind the scenes, the progress window stays up as long as the result file is growing.
AUDIO: Converts between various formats (see below).
VIDEO: Converts between various formats. Can also produce audio-only from a video source. Video size can be scaled by specifying a new width - the new height is calculated based on aspect ratio. A video can also be letter-boxed by choosing the aspect ratio of your display device - calculation automatically determines whether to pad on top/bottom or left/right. Videos can also be rotated to compensate for the type of recorder used (this feature is the only one that relies on mencoder). NOTE REGARDING ROTATION - mencoder has some codec limitations, and depending on the source or destination file type, rotation may fail. This will be detected and reported, but without automatically fixing it. The best course of action is to convert the source first, perhaps to AVI, then use THAT file as the source for your rotation and other changes.
AUDIO AND VIDEO: Can adjust audio volume, sample rate, bitrate. In fact, you can do anything ffmpeg is capable of. Options in default menus offer common operations, but a special KEY-IN function lets you test your own and store them in your own custom file. Further, there's a file of user-submitted options (downloaded separately).
VIDEO FRAMES: Converts an input video into a series of frames in either jpg or png format. The capture rate can range from 1 to 60 seconds between frames, or 'all'.
VIDEO MERGE: If you have selected multiple AVI video files, you'll be given the option of merging them. Other video formats will need to be converted to AVI first. Pre-converting is also recommended if AVI files of differing video or audio quality are to be merged. The final AVI can of course then be converted to the format of your choice.
IMAGES: Convert between various formats. Optionally set resolution for output. If outputting jpg, optionally set quality. A single conversion can specify multiple output types and multiple resolutions.
ISO IMAGES: Why should "images" be limited to "pictures"? Generate an ISO file from source files in the following formats: b5i, bin/cue, csi, daa, mdf, nrg, pdi, uif.
IMAGE SPECIAL CASES: Converting an animated gif to a format other than gif will produce a separate file for each frame in the source. Converting a pdf to an format other than pdf does the same thing. In both cases the "progress indicator" will suggest that there was an error, but this is only because the files created are not named in accordance with what it expects. Be patient if the source contains many frames, and do not click Cancel to the progress window. Also, conversion of a .psd (or similar) which contains layers will generate multiple images in some formats (eg jpg), or an animation (eg gif), so you may want to flatten them first.
TEXT to TEXT: Various conversions between TXT, RTF, HTML, M$Office and OpenOffice, with more being added.
TEXT to SOUND: Produces an audio file from a .txt file. Choose language, gender, pitch and speed.
TEXT to IMAGE: Produces an image of your .txt file. Choose the output image size, font size, colors, border, and font. Text is automatically rewrapped as needed, based on the requested image width and font size. After wrapping, if the text will not fit on a single image vertically, multiple image pages will be generated.
GENERAL:
- The source file is not overwritten. The destination file is named for the source with a new extension.
- An image conversion will also insert resolution into the destination name.
- If any conversion would produce the source filename (eg changing image jpg quality only, or audio bitrate only, or same conversion twice), "new" is inserted into destination name or user is prompted to supply a name.
If you are missing any packages or plug-ins that it relies on, it will try to help. Help and notes are within the script at the very bottom.
REQUIRES:
xterm . . . . . . . . used to inform user if zenity not installed, and to auto-fix zenity defaults
zenity . . . . . . . . for all dialogs
ffmpeg . . . . . . . everything video and audio
imagemagick . . image and text-to-image
bc . . . . . . . . . . . . to do math calculations
CODECS (more is always better):
amrwb
faac
faad2
ffmpeg-libs
gpac
gstreamer-ffmpeg
gstreamer-plugins-*
xmms2-avcodec
xmms2-wma
OPTIONAL:
transcode . . . . . for merging avi
translate/libtranslate . language translation
curl . . . . . . . . . . language translation
links/elinks . . . . language translation
nautilus-actions . add directly to context menu
kdegraphics . . . GUI colors in text-to-image
espeak . . . . . . . text to audio
faac . . . . . . . . . required for m4a audio
faad2 . . . . . . . . mpeg-2 and mpeg-4
antiword . . . . . . M$Office to txt and rtf
unrtf . . . . . . . . . rtf to txt and html
odt2txt . . . . . . . OpenOffice to txt and xml
txt2tags . . . . . . txt to html
libavcodec-unstripped-52 . avi to .mp4
AcetoneISO . . . disk images b5i/cdi/mdf/nrg/pdi to ISO.
nrg2iso, daa2iso, cdd2iso, uif2iso, bchunk . more disk images to ISO
mencoder . . . . . to rotate videos
Upon startup, "ffmpeg" and "file" are both executed against the source file, and the information gathered is displayed in the initial windows. This is helpful in deciding what choices to make, especially if the source file happens to be of an 'unknown' type. If the script cannot figure out what to do with a file, it will let you specify whether to treat it as audio, video, image, or text.
The destination is chosen from a list of common and appropriate file extensions. If you want something that's not listed, you can click OTHER and type in any extension that is appropriate for the input file type and conversion being done.
For a typical system (eg, mine :-) conversions for the following image, audio and video formats...
Image formats supported by convert (ImageMagick)
-- Readable:
A ART AVI AVS B BMP C CAPTION CIN CMYK CMYKA CR2 CRW CUR CUT DCM DCR DCX DFONT DNG DPX EPDF EPI EPS EPSF EPSI EPT EPT2 EPT3 FAX FITS FRACTAL FTS G G3 GIF GIF87 GRADIENT GRAY ICB ICO ICON IPL JNG JP2 JPC JPEG JPG JPX K LABEL M M2V MAP MAT MIFF MNG MONO MPC MPEG MPG MRW MSL MSVG MTV MVG NEF NULL O ORF OTB OTF PAL PALM PAM PATTERN PBM PCD PCDS PCL PCT PCX PDB PDF PEF PFA PFB PFM PGM PGX PICON PICT PIX PJPEG PLASMA PNG PNG24 PNG32 PNG8 PNM PPM PS PSD PTIF PWP R RAF RAS RGB RGBA RGBO RLA RLE SCR SCT SFW SGI STEGANO SUN SVG SVGZ TEXT TGA TIFF TILE TIM TTC TTF TXT UYVY VDA VICAR VID VIFF VST WBMP WMF WMZ WPG X X3F XBM XC XCF XPM XV XWD Y YCbCr YCbCrA YUV
-- Writable:
A ART AVS B BMP BMP2 BMP3 C CIN CIP CLIP CMYK CMYKA CUR DCX DPX EPDF EPI EPS EPS2 EPS3 EPSF EPSI EPT EPT2 EPT3 FAX FITS FTS G G3 GIF GIF87 GRAY HISTOGRAM HTM HTML ICB ICO ICON INFO IPL JNG JP2 JPC JPEG JPG JPX K M M2V MAP MAT MATTE MIFF MNG MONO MPC MPEG MPG MSL MSVG MTV MVG NULL O OTB PAL PALM PAM PBM PCD PCDS PCL PCT PCX PDB PDF PFM PGM PICON PICT PJPEG PNG PNG24 PNG32 PNG8 PNM PPM PREVIEW PS PS2 PS3 PSD PTIF R RAS RGB RGBA RGBO SGI SHTML SUN SVG SVGZ TEXT TGA THUMBNAIL TIFF TXT UIL UYVY VDA VICAR VID VIFF VST WBMP X XBM XPM XV XWD Y YCbCr YCbCrA YUV
--NOTE that "readable" or "writable" do not necessarily imply "useful" :-Q
Audio/Video formats supported by ffmpeg
-- Read/Write:
3g2 3gp 4xm MTV RoQ aac ac3 adts aiff alaw amr apc ape asf asf_stream au avi avm2 avs bethsoftvid c93 crc daud dsicin dts dv dv1394 dvd dxa ea ea_cdata ffm film_cpk flac flic flv framecrc gif gxf h261 h263 h264 idcin image2 image2pipe ingenient ipmovie libdc1394 lmlm4 m4v matroska mjpeg mm mmf mov mov,mp4,m4a,3gp,3g2,mj2 mp2 mp3 mp4 mpc mpc8 mpeg mpeg1video mpeg2video mpegts mpegtsraw mpegvideo mpjpeg mulaw mxf nsv null nut nuv ogg oss psp psxstr pva rawvideo redir rm rtp rtsp s16be s16le s8 sdp shn siff smk sol svcd swf thp tiertexseq tta txd u16be u16le u8 vc1 vc1test vcd video4linux video4linux2 vmd vob voc wav wc3movie wsaud wsvqa wv x11grab yuv4mpegpipe
Final notes... 2 years ago
[ READ ME!! ] After processing, the last part of the output from the actual conversion program used is displayed to confirm proper operation or to help diagnose any problems. If there are problems, you can view the complete output: in /tmp, list the files with "ls -lrt" which will show the newest at the bottom. The files that capture conversion output are named as follows: conversion-program.NNNNN where NNNNN is the PID of the process that ran. For example, you might see "ffmpeg.8512" or "antiword.405". Just view the file and look for the first error listed, which is probably the culprit.
=====
0.56 It is now possible to replace originals during a conversion IF:
1 - converting images
2 - converting into the source folder
3 - converting to only one file type
4 - converting to only one resolution
If these conditions are all true, you will be prompted before the conversion begins. If you choose YES:
1 - originals are replaced with the converted files
2 - the new files will have a different extension if appropriate
3 - the new file names will not have the resolution inserted
0.60 You are invited to submit your own custom option sets, which will be added to a "user submissions" config file that will be posted here and available for download!
0.61 Now recognizes .vob files - just mount your DVD and rip away!
0.65 When a keyed-in option is used in audio or video conversion, if you add a "comment" (a # followed by text), then that option set will be automatically added to your ~/.config/avconvert/avconvert.ffopts.custom file for future use
0.90 Merging multiple AVI files. If all the files you select are AVI, a new prompt will offer to merge them to a single AVI. All the source files should be of the same size/bitrate/etc (you may want to pre-convert them to ensure this).
0.93 New "veryquiet" option to completely turn off progress popups. To enable this after upgrading to 0.93, go to the directory ~/.config/avconvert and either remove the file "avconvert" (the next run will create a new one), or edit that file and add the line "veryquiet=y".
0.94 Translations work once again (if you have them turned off, just remove ~/.config/avconvert/avconvert.lang to reset). Various minor fixes as well, like an adjustment for a change in how Zenity works.
0.95 Google no longer offers the translation API as a free service. Changed things to use the built-in "libtranslate" function, which automatically references multiple such services. It's a little slower, but works.
0.97 Adjustments to detecting libtranslate. Also fixed a bug that, when converting multiple multimedia files, destination folder is asked for in each loop.
0.98 Recognizes when only VOB file(s) are selected and offers to rip DVD to an AVI on the Desktop.
0.99 Added SVG file type to image conversions. Due to a change in ffmpeg output when analyzing a video, rewrote the parsing of this output (still compatible with older ffmpeg versions).
0.999 For Arch Linux, added detection and use of package translate-shell. In Audio/Video section, small changes to acomodate latest ffmpeg command-line args.
Final notes... 2 years ago
[ READ ME!! ] After processing, the last part of the output from the actual conversion program used is displayed to confirm proper operation or to help diagnose any problems. If there are problems, you can view the complete output: in /tmp, list the files with "ls -lrt" which will show the newest at the bottom. The files that capture conversion output are named as follows: conversion-program.NNNNN where NNNNN is the PID of the process that ran. For example, you might see "ffmpeg.8512" or "antiword.405". Just view the file and look for the first error listed, which is probably the culprit.
=====
0.56 It is now possible to replace originals during a conversion IF:
1 - converting images
2 - converting into the source folder
3 - converting to only one file type
4 - converting to only one resolution
If these conditions are all true, you will be prompted before the conversion begins. If you choose YES:
1 - originals are replaced with the converted files
2 - the new files will have a different extension if appropriate
3 - the new file names will not have the resolution inserted
0.60 You are invited to submit your own custom option sets, which will be added to a "user submissions" config file that will be posted here and available for download!
0.61 Now recognizes .vob files - just mount your DVD and rip away!
0.65 When a keyed-in option is used in audio or video conversion, if you add a "comment" (a # followed by text), then that option set will be automatically added to your ~/.config/avconvert/avconvert.ffopts.custom file for future use
0.90 Merging multiple AVI files. If all the files you select are AVI, a new prompt will offer to merge them to a single AVI. All the source files should be of the same size/bitrate/etc (you may want to pre-convert them to ensure this).
0.93 New "veryquiet" option to completely turn off progress popups. To enable this after upgrading to 0.93, go to the directory ~/.config/avconvert and either remove the file "avconvert" (the next run will create a new one), or edit that file and add the line "veryquiet=y".
0.94 Translations work once again (if you have them turned off, just remove ~/.config/avconvert/avconvert.lang to reset). Various minor fixes as well, like an adjustment for a change in how Zenity works.
0.95 Google no longer offers the translation API as a free service. Changed things to use the built-in "libtranslate" function, which automatically references multiple such services. It's a little slower, but works.
0.97 Adjustments to detecting libtranslate. Also fixed a bug that, when converting multiple multimedia files, destination folder is asked for in each loop.
0.98 Recognizes when only VOB file(s) are selected and offers to rip DVD to an AVI on the Desktop.
0.99 Added SVG file type to image conversions. Due to a change in ffmpeg output when analyzing a video, rewrote the parsing of this output (still compatible with older ffmpeg versions).
0.999 For Arch Linux, added detection and use of package translate-shell. In Audio/Video section, small changes to acomodate latest ffmpeg command-line args.
marc41
10 years ago
-- Marc
Report
skooter1121
10 years ago
I see that it is a XFCE app. I'd need to install all the libraries [50 meg +/-] which I'd rather not do. I'm running eeebuntu on a netbook with only a 4 gig SSd. I'm trying to save as much space for my stuff.
-Skooter
(I see you have put out another update, I'll look at it later.)
Report
marc41
10 years ago
So now I better understand your dilemma. One suggestion I could make, separate from the renaming issue: I had an eee-701 4G for a while, and kept a 4G SDRAM mounted on $HOME which helped a lot! Also, for better performance, your mounts in /etc/fstab can have the options "noatime,nodiratime", which also makes the SSD (and flash) last longer.
Back to renaming... Would adding a filename-cleanup to the converter be what you're looking for? IE, to replace or remove annoying file naming characters in the destination file.
By keeping it simple, I'm trying to avoid bogging down the conversion with a bunch of naming-questions.
-- Marc
Report
marc41
10 years ago
Report
marc41
10 years ago
So now I better understand your dilemma. One suggestion I could make, separate from the renaming issue: I had an eee-701 4G for a while, and kept a 4G SDRAM mounted on $HOME which helped a lot! Also, for better performance, your mounts in /etc/fstab can have the options "noatime,nodiratime", which also makes the SSD (and flash) last longer.
Back to renaming... Would adding a filename-cleanup to the converter be what you're looking for? IE, to replace or remove annoying file naming characters in the destination file.
By keeping it simple, I'm trying to avoid bogging down the conversion with a bunch of naming-questions.
-- Marc
Report
skooter1121
10 years ago
Still I'd rather use Nautilus for changing file and folder names as I'd rather not need to open another app. I'm usually fixing one at a time and use GPrename for bulk stuff.
Would be nice to have it as part of Nautilus. Would make life easier.Seems like you have done most of the work already.
-Skooter
Report
marc41
10 years ago
Here is a short piece of code. Save it to a file in ~/.gnome2/nautilus-scripts, and make it executable.
=======
#!/bin/bash
# Quick script to start the Thunar daemon if not already running, and
# then start the Thunar program in bulk-rename mode on selected files
#
# marc brumlik, tsi-inc@comcast.net, Sat Oct 17 10:27:23 CDT 2009
ps -ef | grep Thunar | grep -v grep | grep daemon || Thunar --daemon &
sleep .5
Thunar -B "$@"
========
Now select some icons, right-click, and run the script.
Try it and get back to me...
-- Marc
Report
skooter1121
10 years ago
Wondering if you have considered the ability to change file or folder names.
Like UPPERCASE, lowercase, Sentence Case, replace (_) with ( ), replace extra (.) with ( ).
Been looking for scripts like these but to no avail.
Also is the ability to edit a video included, by setting start/end variables? Or load external external program to do so, like Avidemux?
This looks great!
-Skooter
Report
marc41
10 years ago
>> Wondering if you have considered the ability to change file or folder names.
The script does do "some" renaming of output file names. First, if you perform a conversion which would create a result file of the same name as the original, you are prompted. Second, the script will always put the new/proper extension on the result file. In the case of images, by default it will insert the new resolution into the name.
Also, when initiating a conversion, you have the option of creating and naming a new folder for the result files (by default, they are created in the source directory of the first selected source file).
>> Like UPPERCASE, lowercase, Sentence Case, replace (_) with ( ), replace extra (.) with ( ).
If you're needing a general purpose renaming utility, I can suggest installing "Thunar", and then execute it with the "--bulk-rename" function.
>> Also is the ability to edit a video included, by setting start/end variables? Or load external external program to do so, like Avidemux?
Yes, you can set start/stop times relating to the source file, as well as max-time or max-file-size relating to the destination file. There are so many possibilities that I did not list them in the menu of common conversions. However, if you click on "KEY-IN" at the bottom of that list, you will be able to create anything you like. The window into which you enter your own options will be overlayed upon a window showing summaries of ffmpeg's options. Any set of options that you find useful can be permanently stored in ~/.avconvert.ffopts.custom using your favorite editor, and those additons will then be presented in the menu next time you do a conversion.
Further, if you come across a set of ffmpeg options that you think other people would like to use, please email them to me (instructions are in the ffopts.custom file) and I will publish them on this download page (see the last link) as ffopts.submissions which anyone can download and copy to $HOME.
Does this help?? Have fun!
Report
marc41
10 years ago
Report
waltercool
10 years ago
Maybe you should check first it..
Ex: If 'exist /usr/share/zenity/zenity.glade' try fix
Report
waltercool
10 years ago
Now works fine, thanks!
Report
marc41
10 years ago
I currently check for zenity.glade in /usr/share/zenity. This is a variable, and could easily be changed as needed.
If you have "locate" installed, see if you can find zenity.glade on your system and let me know where it is. If you do not have "locate", then try this:
find / -type f -name "zenity.glade" -print
I will gladly adjust the script.
-- Marc
Report
waltercool
10 years ago
Can you add links OR elinks? Elinks is links compatible, so, the code is the same
Thanks!
Report
marc41
10 years ago
This program is actually only needed for the new translation routines, which are not needed if English is selected. However, I use it top bring up the list of languages (by querying Google directly). Perhaps I ought to ask first "English / Something Else", since if English is selected, then elinks and curl are not needed.
I will fix the elinks issue right now. Thanks for bringing this to my attention. It's always interesting (and sometimes surprising) to hear what happens when this is run on other distros (mine is Fedora).
-- Marc
Report
sergeant
10 years ago
Stay frosty gents.
- sgt. Vk over and out
Report
marc41
10 years ago
-- Marc
Report
humbug
10 years ago
Congratulations for the goog work.
I have i problem converting .avi in .flv:the file generated is 0 byte!!!! I give a look to ffmpeg.NNNNN files in /tmp.It says that"Error while opening codec for output stream #0.1 - maybe incorrect parameters such as bit_rate, rate, width or height" How can i be sure that the parameters are correct before conversion? i hope i haven't to guess them...
Report
marc41
10 years ago
Step 1: If you requested a change to bitrate or video size, try running it without choosing any of those options. The script does not actually check to ensure that you've chosen something appropriate. Choosing nothing leaves those options at default, which should always work.
Step 2: You may be missing a package that ffmpeg relies on for this conversion. The ffmpeg.NNNN file in /tmp will identify whether stream #0.1 is the video or the audio, which will give you a clue. Also in that file, you will see the libraries ffmpeg has found. On my system that section looks like this:
generic -fasynchronous-unwind-tables -I/usr/include/openjpeg --extra-version
rpmfusion --enable-bzlib --enable-libdc1394 --enable-libfaac --enable-libfaad --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-x11grab --enable-avfilter --enable-avfilter-lavf --enable-postproc --enable-swscale --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir
/usr/lib --cpu
There is a list of packages on my submission page. Try installing them one-by-one and try the conversion after each.
Are you converting avi->flv or flv->avi? When you find the package that fixes your system, let me know and I will add a specific test for that.
-- Marc
Report
humbug
10 years ago
I'd like to convert avi into flv
In the report file says:Error while opening codec for output stream #0.1 the stream is the audio one and the output codec is adpcm_swf,maybe is this that leak?
Report
humbug
10 years ago
i can convert from flv to avi,i think because of the flv file as mp3 audio.
Report
humbug
10 years ago
Report
marc41
10 years ago
Report
marc41
10 years ago
Report
marc41
10 years ago
Depending on the type of source and destination files, and the content of the source file, ffmpeg may need to be handed additional specific options.
Report