Audio/Video/Image/Text/ISO Convert

Nautilus Scripts

Source i (link to git-repo or to original if based on someone elses unmodified work):

Add the source-code for this project on opencode.net

50
Become a Fan
8.1

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.

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.

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 (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!

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




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 SOUN 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
Last changelog:

Final notes...

[ 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.


Ratings & Comments

381 Comments

guesst

For Debian/Ubuntu the package to install is called translate-shell, i don't know if somebody can help me but when i start the script, nothing happends and only seems to be stucked on gawk, did somebody have this problem?

marc41

Hello! The last change, four years ago, was to fix something very similar. I will set up an Ubuntu VM to see what broke. Maybe installing the packages for translation should be optional. I'll look at that too.

guesst

Thanks Marc, please let me know if you need anything

goexplorer

Hi, ubuntu 20.04 has no libtranslate-bin. Is there a way, to fiddle around it or use avconvert without having the translate ability?

truelove500

didn't worked for me... it keep asking for installing libtranslate which not found in arch linux distro AUR. I wish I have a way to overcome this

marc41

Hello!! I do not have an Arch Linux set up here, but I have done some research. I am sure that the package you need is "translate-shell" https://aur.archlinux.org/packages/translate-shell/ I will adjust the script to add this as satisfying the requirement and re-post with a new version number. I am sure this will fix it for you. Let me know after you have tested it. -- Marc

marc41

I have just uploaded the change. The new version is 0.999 Does this now work for you??

amorpher

No. I've installed translate-shell and: "Please install the package "libtranslate" or "libtranslate-bin" or "translate-shell" (whichever your distro offers) and start the conversion again!" //Arch Linux user

amorpher

translate-shell 0.9.4-1 https://www.soimort.org/translate-shell Files: /usr/bin/trans /usr/bin/translate-shell /usr/share/licenses/translate-shell/LICENSE /usr/share/man/man1/trans.1.gz /usr/share/man/man1/translate-shell.1.gz

marc41

OK. It looks good. My script tests two things, trying to be sure that the package is installed. First, it looks for the binary (in Arch, /usr/bin/trans). That part should have worked fine. Then the script does a second test. In Fedora and Ubuntu and others, the command "info translate" (or "info translate-bin") returns a text page that includes the string "translate a text or web page". I'm checking for that, just in case I found a program named "translate" that isn't actually the package that's needed. So please on your system type "info trans" to see what you get. If nothing, then I'll remove the test for 'translate-shell'. Or if you DO get something, please message me with a short piece of the text you see that could be used as this test (something that's probably unique).

amorpher

info trans shows man trans

marc41

I don't think I stated my question clearly enough... What I'm wanting is some text from either "info trans" or from "man trans" that the script can use to guarantee that the /usr/bin/trans it finds is indeed the "translate-shell" package. For example, on my system (Fedora, which installs /usr/bin/translate): "info translate" and "man translate" both display text that includes the phrase "translate a text or web page". On your system, do you get something similar? I just need to know what phrase to look for, and whether to use "info" or "man", so I can add that second test properly for Arch.

amorpher

On Arch Linux "info trans" & "man trans" display the same manual file — /usr/share/man/man1/trans.1.gz: TRANS(1) TRANS(1) NAME trans - Command-line translator using Google Translate, Bing Translator, Yandex.Translate, etc. SYNOPSIS trans [OPTIONS] [SOURCE]:[TARGETS] [TEXT]... DESCRIPTION This tool translates text into any language from the command-line, using a translation engine such as Google Translate, Bing Translator and Yandex.Translate. Each argument which is not a valid option is treated as TEXT to be translated. If neither TEXT nor the input file is specified by command-line arguments, the program will read and trans‐ late from standard input. OPTIONS ... 0.9.4 2016-05-18 TRANS(1)

marc41

OK -- Updated version is in place... Let me know what happens!!

amorpher

OK, it work but very slow. And... Look at this screenshot — https://u.teknik.io/0gSV4.png

marc41

My guess is that we're still dealing with the translate-shell program and that it must behave differently than the "translate" in Fedora and Ubuntu. Did you set the language to something other than English? If you did, then try this and send me the results: echo -e "This is a test of\ntranslate-shell" | sed 's/$/++/' | trans

amorpher

LANG=en_US.UTF-8 only. $ echo -e "This is a test of\ntranslate-shell" | sed 's/$/++/' | trans This is a test of++ This is a test of++ translate-shell++ translate-shell++

marc41

When you answered the initial setup questions, did you set the language to something other than English?

amorpher

LANG=en_US.UTF-8 only.

marc41

I see it!! The Fedora/Ubuntu "translate" program outputs only the translated text. The Arch version has the "-verbose" option set by default, which tells it to display each original line, followed by the translation in bold print (using escape sequences). THAT'S THE PROBLEM!! The solution should be to add the "-b" option (for "brief"). I have done that and re-posted.

amorpher

Last version (2017-01-05 17:28:52) seems work fine. I didn't change something.

marc41

It works fine and you did NOT download the fixed version I posted? That would be weird! Does it still seem to be slow?

amorpher

Everything is OK. Thank You very much.

rojthevorlon

An audio file integrity checker, again a la Foobar2000 on Windows. That and the capability to add ReplayGain tags would finally break the last dependency I have on the Windows platform.

marc41

Anything to help a comrade leave M$ :-)

Pling
0 Affiliates
Details
license
version 0.999
updated
added
downloads 24h 0
mediaviews 24h 0
pageviews 24h 1

More Nautilus Scripts from marc41:

newrez - Increase Screen Rez For Netbook
marc41
last update date: 11 years ago

Score 8.1

newrez-v
marc41
last update date: 12 years ago

Score 5.7

imagelabel - Attach text to images
marc41
last update date: 14 years ago

Score 5.0

Watcher -- Zenity Progress Window
marc41
last update date: 15 years ago

Score 6.5

Ordinator - sort images during drag/drop
marc41
last update date: 15 years ago

Score 5.0

Other Nautilus Scripts:

Gflv2avi
acidc00l
last update date: 15 years ago

Score 5.0

My Movie Portal v3.2.8
iTechScripts
last update date: 13 years ago

Score 4.7

Browse Nautilus as root
SteveSims
last update date: 17 years ago

Score 5.0

Open Nautilus as Root
Mariux
last update date: 17 years ago

Score 5.0

Compare Strings
cdmn
last update date: 17 years ago

Score 5.0

grooto
pontos
last update date: 17 years ago

Score 5.0



System Tags