Description:
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.
Convert multimedia files from one format to another, change size if desired
Convert multimedia to audio-only files
Convert audio files from one format to another. Both multimedia and audio can specify numerous ffmpeg options
- these options are stored in user-configurable files, including one designed for user submissions
Convert images from one format to another, and/or change image resolution (and jpg compression)
Convert documents from one format to another
Convert text to a .jpg file (an image of your text) or a .wav file (a voice reading your text)
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 Image" files into standard .iso files
Batch processing to apply conversion choices to all selected files in a single operation
Originals are not overwritten. Generated files are named based on the source and conversion choices
Options and preferences in ~/.config/avconvert can be easily modified manually, or recreated by removing them.
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 is currently no built-in editor for that file, but it is plain-text so just use your favorite.
Quote:There is a problem with some ffmpeg version(s) for a conversion that requires the "aac" audio codec. ffmpeg up to 0.5-2 works fine but 0.5-3 will complain "Unknown encoder "libfaac".
This has been fixed by ffmpeg 0.5-5 (and perhaps 0.5-4).
Comments welcome, suggestions invited, votes appreciated.
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 (set "paramater" to "%M", check "multiple files")
(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 nearly 2000 lines of code!
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! :-) :-)
The following files will automatically be created in $HOME/.config/avconvert the first time you run avconvert:
a) avconvert: preferences for prompt-destination-folder, loop through multiple files, fix zenity, "quiet", default image type
b) avconvert.lang: language setting and preferred translation service
c) avconvert.ffopts.audio: predefined options that relate to conversion of audio files
d) avconvert.ffopts.video: predefined options that relate to conversion of video files
e) avconvert.ffopts.custom: your own options for any ffmpeg conversions
f) avconvert.ffopts.submissions: ffmpeg options for specific tasks submitted by users like you
g) avconvert.ffmpeg-help: summary of common ffmpeg options, displayed when key-in is chosen as a conversion option
The custom ffopts file will not be replaced during an upgrade. If you want to return it to its default state, just remove it and the script will create a new one for you. The *submissions file is never created by the script, and is a separate download on this page.
The first time avconvert is run, it will check for the most important packages it relies on. Some conversions require specific packages, which will be checked when those are used. The first run will also ask your preferences and store them in ~/.avconvert. The easiest way to change those is simply to remove that file and have it ask again. Also, the first run will fix zenity defaults so that the windows grab keyboard and mouse focus and pop up on top. The preference "quiet" sets them back to popping underneath without focus, and also changes some of them to just create icons in the notification area of the Gnome panel.
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 letterboxed 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).
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'.
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
CODECS (more is always better):
amrwb
faac
faad2
ffmpeg-libs
gpac
gstreamer-ffmpeg
gstreamer-plugins-*
xmms2-avcodec
xmms2-wma
OPTIONAL:
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
The source file is identified using the system's "file" command as well as some hard-coded extensions. If this fails, the user is asked if the source is image, audio or video.
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.
The destination is chosen from a list of common and appropriate file extensions, or the user can choose OTHER and key in any valid file extension for the media type.
As each conversion begins, a separate process is started in the background to indicate conversion progress. It first waits for the output file to have a non-zero size, then shows a %complete estimation (assuming the destination will grow to the size of the source). It may close before reaching 100% (if the destination is smaller than the source), or may reach 98% and appear to stall (when the destination grows larger than the source). I've separately posted this portion of avconvert as the nautilus script named "Watcher".
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
Changelog:
Comments at the end of the script describe how to modify things like:
available and default output types
bitrate choices when writing audio
resolution choices when writing images
jpeg quality if writing jpg images
fonts for text->image
etc etc
[ 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.57 Better dialog for delete-originals option.
Also made the progress-indicator smarter and other minor improvements.
0.58 Will inform you if a newer version has been posted here.
0.59 Adjusted zenity so it doesn't auto-close conversion
when ffmpeg hesitates on very long files.
0.60 This version adds many more options for audio and video conversions.
It also lets you key-in options for testing, and then to add your own custom options
(and modify the supplied options) simply by editing a small text file.
AND 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 Improved the functioning of text->image and of video->frames.
Now recognizes .vob files - just mount your DVD and rip away!
Also, by piping all dialog text through Google's translation web site,
the program is now multi-lingual.
0.62 Translation can now choose between the service provided by Google or Babel.
0.63 Adjustments including recognizing that the "elinks" package can be installed instead of "links"
0.64 When choosing a language, the default will be your current $LANG= setting. Video size changes now based on a new-width choice, with height calculated for you based on aspect ratio. Video can also be letterboxed simply by choosing the aspect ratio of your display device.
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.66 Config files moved under ~/.config/avconvert, better language management, less new-version nagging.
0.67 OOPS! This version corrects an error in assembling the ffmpeg command. If ffmpeg won't create a conversion file, and the status is "Unable to find a suitable output format for 'pipe'", then upgrade to this version. SORRY!!!
0.68 OOPS AGAIN!!! Another correction to a recent change. Fixed padding parameters to ffmpeg for aspect ratio conversion.
0.69 acodec-mp3 changed to acodec-libmp3lame, adjust aspect math
0.70 After conversion "move originals to trash" dialog is now optional, corrected some text that did not display when translated.
0.71 Fixed "file not found" when the source name contained [ or ] characters
0.72 There are three valid audio sample rates for FLV files (according to ffmpeg). If converting to FLV and no sample rate is specified, and the source file rate is not one of these three, the script now assigns the best match automatically.
0.73 Image conversion now implements the "normalize" and "equalize" functions of ImageMagick's convert.
0.74 Eliminated repetitive prompt when batch-processing audio/video, fixed the "adjust audio volume" function, added .3gp and .3g2 to auto-recognized video formats, removed erroneous dialog that popped up if a conversion is cancelled after it has begun.
0.75 Longer timeout when retrieving language list, with default to English if no list arrives. IF YOU USE TRANSLATION let me know if the timeout for retrieving translations needs to be lengthened as well!
0.76 Moved Audio-Volume from separate popup to main options popup. Added Audio-Bitrate to main options.
0.77 In Ubuntu 9.10 there is no zenity.glade config file, added test for this. Made numerous small adjustments. Made correction to KEY-IN ffmpeg options being stored in avconvert.ffopts.custom file
0.78 Options to ffmpeg from the 'custom' and 'submissions' files are now available during Audio conversion.
0.79 Minor fix to KEY-IN popping up unnecessarily. When in quiet-mode, ffmpeg notifications will auto-close after 60 seconds to reduce clutter.
0.80 Corrects parsing of a line in the ffopts.custom file, when it contains multiple options to ffmpeg. Also performs some validity checks of options in that file.
0.81 Videos can now be rotated (requires mencoder). Video-->frames conversion has been improved.
0.81 Greek translation now available (of course this is FAR better than Google/Babel!!). Thank you vagrale1
License: GPL
|