Linux Video Converter


Try this updated post instead… AMV files in Linux – revisited



Updated 01-Feb-2009 Tested on .flv and .avi files but should work on almost all recognised video formats.

This script simply asks you to select an avi file to turn into an amv file. You’ll need ffmpeg libraries to make this work…

In a terminal…
sudo apt-get install subversion
svn checkout http://amv-codec-tools.googlecode.com/svn/trunk/ amv-codec-tools
cd amv-codec-tools/AMVmuxer
make build

Then use this to convert your files. Run the file, you’ll get this window:
run?
Select “Run” and the following window will open:
avi to amv converter for linux1
Find your file and Click OK:
avi to amv converter for linux2
When the conversion is over you should get this window:
avi to amv converter for linux3

That’s it! Check the destination given(should be saved in the same place as the original file with a .amv extension instead of .avi).
The only way I’ve been able to play .amv files in Linux is using SMPlayer under Wine.

Download (Downloaded 217 times) | Signature

9 comments

1 ping

  1. YouTube mp3 download

    Good option for a Linux users. Thank you!

  2. Richard

    Nice post, I don’t suppose you know a way to add this to nautilus actions right click menu?

    1. Avatar of billy
      billy

      hi richard, check out my replies below… Thanks for getting me onto this. It’s been so long since I did any multimedia stuff I’d even lost the amv ffmpeg build from my own machine… glad I wrote this post tbh! ;oP

      Hopefully what I have below will do you nicely… (skip the first bit of code and put in the second instead – I posted as I moved around, should probably remove the first one but will leave it for someone who does still have xdialog…

      Cheers!

  3. Avatar of billy
    billy

    try…

    open ~/.gnome2/nautilus-scripts

    create a new file, call it whatever you like, I suggest “convert to amv” or something

    type in the following lines and make it executable (chmod +x or right click/properties/permissions – allow executing…), then right click on a file and you should have “convert to amv” listed under scripts, click it and wa-hey…

    #!/bin/bash
    for uri in $NAUTILUS_SCRIPT_SELECTED_URIS; do
    INFILE="$uri"
    FORMAT=${INFILE:(-4)}
    OUTFILE=${INFILE/$FORMAT/.amv}
    if [ "$INFILE" ]
    then
    cd ~/amv-codec-tools/AMVmuxer ;
    ./ffmpeg/ffmpeg -i "$INFILE" -f amv -r 16 -s 160x120 -ac 1 -ar 22050 -qmin 3 -qmax 3 "$OUTFILE" ;
    Xdialog --title "File Converted" --msgbox "Check $OUTFILE" 8 100 ;
    else
    Xdialog --title "No File Selected" --msgbox "No File Selected -- Aborting" 8 50 ;
    fi
    done

    …fwiw I did this and the file converted but I didn’t get the Xdialog confirmations… I may well have lost Xdialog in various updates/reconfigurations, I wrote this script a while ago. Try it and see…

  4. Avatar of billy
    billy

    ah, xdialog was dropped from ubuntu…

    http://ubuntuforums.org/showthread.php?t=1476889

    I’ll need to do a re-write for zenity eh…

  5. Avatar of billy
    billy

    The zenity rewrite…

    #!/bin/bash
    for uri in $NAUTILUS_SCRIPT_SELECTED_URIS; do
    INFILE=$uri
    FORMAT=${INFILE:(-4)}
    OUTFILE=${INFILE/$FORMAT/.amv}
    if [ "$INFILE" ]
    then
    cd ~/amv-codec-tools/AMVmuxer ;
    ./ffmpeg/ffmpeg -i "$INFILE" -f amv -r 16 -s 160x120 -ac 1 -ar 22050 -qmin 3 -qmax 3 "$OUTFILE" ;
    zenity --title "$FORMAT to .amv File Conversion Complete" --info --text="${INFILE/file:\/\// } has converted \n\n Check ${OUTFILE/file:\/\// }" 8 100 ;
    else
    zenity --title "No File Selected" --info --text="No File Selected -- Aborting" 8 50 ;
    fi
    done

    that else should never activate, as line 1 tells the script to run for each file selected (which of course means we can now select more than one file at a time, w00t w00t!) hence the file won’t run if no files are selected… y’get me?!

    Incidentally if you want it as a top-level menu item, follow the steps in this post:

    http://techthrob.com/2009/03/02/howto-add-items-to-the-right-click-menu-in-nautilus/trackback/

    then in the script above change line 2 to:

    for uri in $@; do

    then in the nautilus actions config dialog, add a new item with the following settings:

    Action Menu
    Display item in selection
    Enabled

    Command Menu
    path(for example, put your path to the script here, use the quotes if there are spaces in the filepath[again make sure the script is executable]…): “/home/billythekid/.gnome2/nautilus-scripts/convert to amv”
    parameters: %M

    Conditions Menu
    Only Files
    appears if multiple…

    then save the configuration and the menu should immediately be available…

    that should sort you out too. You can play with the settings in there for it eg mime-types etc. I know 3gp doesn’t convert(here anyway – play with ffmpeg too see what you get)

  6. Richard

    Thank you for taking the time to do that, Billy, but When I make build I get a lot of errors come up but I don’t know if they are relevant.

    I successfully converted videos with the following extensions thanks to you :.flv .mov .mpg and even .wmv, they all play on Iteddy no problems, thank you for that!

    With .3gp and .mp4 files it just gives me a empty text file called filename.amv (I assume that’s what you got with your trial of 3gp), I’m thinking they are never going to convert.

    Could I have your help with the following two issues please?

    1)When I try to convert a .avi file it starts to convert and stops before finishing, leaving a really small .amv file that wont play, original file is 10.5MB and amv file is 10.2MB, any ideas with that one?

    2)It doesn’t like seem to like spaces in file names and if I try to convert a file anywhere but the home folder it does a similar thing, for example, if I try to convert a file called “my home movie.flv” it will say “/home/richard/my has converted Check /home/richar.amv” followed by “home has converted Check .amv” and then “movie.FLV has converted
    Check movie.amv” and hasn’t converted anything, this one sounds like a silly error on my part but I can’t put my finger on it.

    Thanks again!

    1. Avatar of billy
      billy

      Heya, no you’re quite right about the spaces in the filename thing, if you’re doing only single files you can put quotes around the %M thus: “%M” and that should deal with it, this won’t allow multiple files to be converted tho.(because %M is telling it to read a ‘space-seaparated’ list of files – hence spaces not working)

      I did a re-write of all this to hopefully make a clearer post of it at http://geekery.the-kid.org/2011/09/20/amv-files-in-linux-revisited/ and I mention the filename space issue there.

      Don’t worry about build errors, a common issue. I’m glad you got wmv files to convert, it’s all down to codecs and how ffmpeg is built, you can add flags at build time to include different formats. I actually have separate ffmpeg installs on this pc, one that’ll convert just about anything (but won’t output AMVs) and this one! This is stupid I’m sure but I’m not sure how best to fix it… seems every time you build ffmpeg it breaks something else… lol (the joys of linux eh)

      As for your hanging conversions I’m not sure about at all, try converting to something else first maybe? I heard AVI isn’t actually a format in it’s own right rather a kind of wrapper consisting of varying compressions/codecs etc. converting twice will probably lose some quality but if you’re using it for an iteddy this is a negligible concern IMHO (the vids do look shocking don’t they, yet keep the kids amused for hours! lol) it’s quite unusual to have the amv file smaller than the original too – again a weird thing, the quality and frame dimensions are smaller/poorer yet the file can be 4× as big! Stupid format. Imran needs to make the iteddy take proper formats instead of these cheap chinese ‘chipod’ style. (rant over!)

      HTH

  7. Richard

    Sorry this bit was supposed to say “original file is 10.5MB and amv file is 1.2MB

  1. AMV files in Linux – revisited | Billy's Blog of Geekery

    [...] Tweet I just did a re-write of one of my most popular hits on this blog. It was all documented in the comments of the script’s page but it’s a bit of a mess so here’s the definitive [...]

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>