Best way to convert avi for youtube in ubuntu?
December 25, 2008 4:18 PM   Subscribe

Recommended route for encoding avi to smaller file size for upload to youtube in ubuntu?

Earlier today I shot an 8 minute movie on my Nikon point & shoot - the avi is 485Mb. I wish to upload this to youtube, so I'd like to reduce the file size. WinFF/ FFMPEG seemed the obvious route here, but when I convert the avi using the "flv for web use 4x3" setting, it compresses the file down to a nice 17.4Mb, but video only. If I select the "WMV2" setting, I get a 47.8Mb file that looks kinda crappy but it does have audio.

Is that as good as it gets? Am I using the correct settings? Is there a better route? Happy Holidays!
posted by The_Partridge_Family to Computers & Internet (16 answers total) 2 users marked this as a favorite
 
Whatever you do, youtube will probably reconvert the file after you upload it anyway.
I'd just do a quick encode into xvid or divx and upload the result. 8 minutes of xvid compressed video should be pretty tiny in terms of MB.

If you don't like ffmpeg, avidemux is a decent conversion app that can be found in the repositories.
posted by jjb at 4:46 PM on December 25, 2008


Iv'e used avidemux and handbrake.
posted by PueExMachina at 5:05 PM on December 25, 2008


Response by poster: OK - I've installed avidemux, and am confused by all the different video, audio and output options.

Imagining that I'm your mom and I need to know how to set up either avidemux or WinFF/ FFMPEG, please go ahead and describe what settings I need to use to create a small file with audio and video.
posted by The_Partridge_Family at 5:14 PM on December 25, 2008


If you were my real Mom, I would tell you to install PyTube from here. It is the simplest thing in the world, the deb package will install all the dependencies, and it will do exactly what you want.

If you were my crazy alien blue puddin' eating fire breathing super cool mom using Kubuntu with the latest beta of KDE 4.2, I would suggest trying Kdenlive. It's the only video editor I've used on Linux that meets the following three criteria: actually works, doesn't crash constantly, easy to use. You might be able to get in running under Gnome, but good luck.
posted by quarterframer at 5:46 PM on December 25, 2008 [2 favorites]


Sorry. Too much nog. Link: Kdenlive.
posted by quarterframer at 5:47 PM on December 25, 2008


Might I also suggest using Vimeo instead of YouTube. The quality of Vimeo blows YouTube out of the water.
posted by AaRdVarK at 5:48 PM on December 25, 2008


Response by poster: Oh boy. Thanks for the answers, but I'm honestly not getting anywhere with the app recommendations without knowing what formats to choose in the settings - PyTube also has a ton of output formats and I'm running out of ways to describe that I don't know which one to choose.
posted by The_Partridge_Family at 6:36 PM on December 25, 2008


avidemux:
Open file
Click button that says "copy" under Video, select "MPEG-4 ASP (Xvid4)"
Click button that says "copy" under Audio, select MP3 (LAME)
Click the save button; name it something new.
Upload result to youtube
posted by a robot made out of meat at 6:40 PM on December 25, 2008 [1 favorite]


Ignore the options to configure stuff.
posted by a robot made out of meat at 6:44 PM on December 25, 2008


Response by poster: a robot made out of meat: under the Video and Audio options I also have a "Format" option, which defaults to AVI. If I leave it as AVI, the resulting AVI is actually larger than the original. I was kinda gunning for the MPEG Transport Stream (V+A) option, but I get an "Incompatible Output Format" error. The other options are; AVI dual audio, AVI Pack VOP, AVI Unpack VOP, MPEG-PS (V+A), MPEG Video, MP4, OGM, PSP, FLV (tried that one - video only), MKV, Dummy.

This is the missing link in my chain - I don't know what *format* to output my encoded avi to.
posted by The_Partridge_Family at 7:22 PM on December 25, 2008


I have heard that there are people that are intentionally trying to confuse you about this because they think it is good for business: You are dealing with four different things here that are often talked about as if they are interchangable

1) container format. The common ones are mov, avi, flv, ogg, and mpeg

2) a data encoding. Some of the common ones for video are mpeg2, ogg theora and h.26X (x being usually 3 or 4); some of the common ones for audio are raw pcm, mpeg3 audio encoding (aka mp3), ogg vorbis, and aac.

3) an encoder: these include ffmpeg for audio and video, mplayer (which also uses ffmpeg for some formats) for audio and video; sox, lame and oggenc for audio.

4) a decoder: any program that plays multimedia, including the previously mentioned encoders that all provide decoder backends.

For youtube, any common container and encoding is fine. You can send them an ogg with theora video and vorbis audio with no trouble whatsoever. Mplayer is known to sometimes make movie files that no other decoder can read, but has enviable coverage in terms of encoding formats, and I have sent youtube h.363 formatted by the mencoder program from the mplayer suite without trouble.

You really do not need to shrink the file yourself, youtube will do it whether you want them to or not, the advantage would be if you wanted to send them something precompressed so hopefully you would have better quality output. In that case encode to the format they send out: h.263 video, mono mp3 audio. For many cases doing your own mono mixdown if your audio is multichannel will be a big improvement, and similar improvements are sure to be had if your video is already h.263 encoded. You can ignore the container format, I would be surprised if the did not decompose the constituant streams as their first processing step no matter what you upload, containers are pretty trivial. Most format conversion software has a setting for how much cpu is devoted to the conversion process, and tweaking that should obviously show some improvement if you want to do the conversion for them. If the file is too big, they will reduce the bitrate by re-encoding even if the file is already the right format, in which case the fewer times the file has been converted the better, so you would have been better of just shooting them the raw file off the camera.

About the people supposedly intentionally obfuscating these issues, the idea is that if you do not know the difference between a container, a format, an encoder, and a decoder, you will see a .acme file and think you have to go buy the acme brand player to play it, and you will think that since your friend watches movies on an acme player the only way to make a movie she can watch is by buying the acme movie encoder.
posted by idiopath at 9:19 PM on December 25, 2008


above: s/h.363/h.263/
posted by idiopath at 9:25 PM on December 25, 2008


Response by poster: idiopath: thanks for your detailed explanation. I do understand that youtube does it's own encoding, I just want to decrease the file size as 485Mb is bit of chunk to throw up online. I get most of what you're saying, except that - as I noted above - if in Avidemux I set the video to XVid4, the audio to MP3 and the format - I assume meaning the container - to avi, then the resultant avi is actually larger than the original, so I'm guessing I can't use that as a container.

I've been tooling around on this all day (way to spend Christmas) and the results I've had are as follows;

a crappy looking 48.7Mb wmv out of WinFF
a better looking (compression-wise) but jerky-as-hell 56.1Mb ogm out of PyTube
no successful combined audio and video file out of Avidemux.

Man - I'm really surprised that the popularity of youtube hasn't meant that this process is an easy one. Or maybe I'm just a fuddy duddy for not shooting all my video on my cell phone....
posted by The_Partridge_Family at 10:44 PM on December 25, 2008


The_Partridge_Family: the container format should not affect file size much, the size/quality is mostly dependent on the encoder. Try the following:

mencoder -ovc lavc -lavcopts vcodec=h263:vbitrate=1000 -oac mp3lame -lameopts preset=medium -vf scale=352:288 -o outputfile.avi <input movie>

This, reading left to right makes a movie using the lavc codec set, H.263 being the specific encoding, mp3 audio output using the lame encoder, with a medium quality audio encoding, with the video rescaled to 352:288 pixel resolution (the valid resolutions for H.263 are 128x96, 176x144, 352x288, 704x576, and 1408x1152), outputting to outputfile.avi, with input from <input movie> (of course change this to the actual location and name of the input file).

Changing the vbitrate (video bitrate) will have a huge effect on the output file size. Try previewing different settings, the movie is playable while mencoder is encoding. Like with almost all command line programs, control-c will kill the encoding process, control-z will suspend it, and the fg command resumes suspended jobs.
posted by idiopath at 11:59 PM on December 25, 2008


Response by poster: OK - tried it; file size = 60Mb which ain't bad, video looks real good, but there's all this audio noise which sounds like garbled dialogue, even though there's only music.

Thanks again for the effort; maybe it's just something wrong with my setup :-(
posted by The_Partridge_Family at 10:29 PM on December 26, 2008


You may wish to try other options for the audio encoding: try replacing preset=medium with preset=180, try larger numbers for better audio quality. Also for better file shrinkages try lower numbers on the vbitrate=1000 option.

The mplayer/mencoder man page is a huge document that is very hard to read first time, but since I already kind of understand it I consider it my duty to the community to translate for others.
posted by idiopath at 2:58 PM on December 28, 2008


« Older Ouch. Too many prunes.   |   What song ends with "I'm getting closer to my... Newer »
This thread is closed to new comments.