View Full Version : [ubuntu] Converting AVI to FLV lossless?
Aptana
August 25th, 2009, 08:39 PM
Hey guys. I have been using imTOO FLV Converter via WINE for this for ages, and now I'm wondering if it would be faster and easier to do this without WINE.
Does anyone know a way to convert AVI files to FLV format (suitable for streaming over the web) with very little/no quality loss? End filesize doesn't really matter.
I have tried ffmpeg before and it didn't really give me the results I wanted. Either that or I'm doing it wrong :P
I've Google'd for an hour, but most of the results are just spam with free software downloads. Annoys me to bits :P
Thanks guys.
FakeOutdoorsman
August 25th, 2009, 09:50 PM
FFmpeg can definitely do this, but since you are going from a lossy to lossy format you can not get a lossless quality. However, perceptively it can look close. I can give you some examples, but I have a few questions to help narrow things down:
1. What Ubuntu version are you using?
2. How are you presenting this video? (Example: Apache, with JW Player, etc)
3. Do you really need streaming? Streaming allows seeking before the whole clip is downloaded, but there are additional steps and I have little experience with this.
Aptana
August 26th, 2009, 12:07 AM
Thank you for the reply.
1) I'm using Ubuntu Hardy.
2) It'll be on the Apache web server and most likely JW Player, yeah.
3) The video's will be for a youtube-like website so yeah I do really :P
Thanks for you help so far :)
peepingtom
August 26th, 2009, 01:31 AM
I suggest you open a terminal, run man ffmpeg > ~/ffmpeg.manual.txt and read the resulting manual in your home directory. You're trying to do something complicated, the manual is easy to understand though. Also learn what audio/video formats are acceptable to be muxed into flv containers, if you want lossless you can have ffmpeg copy streams into different containers if they don't need to be converted.
FakeOutdoorsman
August 26th, 2009, 02:59 PM
Thank you for the reply.
1) I'm using Ubuntu Hardy.
I recommend compiling FFmpeg and x264 yourself to take advantage of the libx264 presets which make encoding much easier:
HOWTO: Install and use the latest FFmpeg and x264 (http://ubuntuforums.org/showthread.php?t=786095)
2) It'll be on the Apache web server and most likely JW Player, yeah.
You can encode H264/AAC audio and throw it into a FLV container. This isn't "standard" practice, but it is easier to use the FLV container for streaming than the MP4 container. With MP4 you would need to use an additional Apache module such as the H264 Streaming Module (http://h264.code-shop.com/trac).
1. Encode:
ffmpeg -i input.avi -acodec libfaac -ab 96k -ac 2 -vcodec libx264 -vpre hq -crf 22 -threads 0 output.flv
2. Run it through flvtool2 or flvtool++ (http://mirror.facebook.net/facebook/flvtool++/) to hint the FLV metadata. I'll use flvtool2 as an example, but flvtool++ is probably a better tool because it doesn't load the whole file into memory to prepare the metadata, and it also doesn't require ruby which can isn't a small package. You need to use one of these tools or your player, such as JW Player, will have issues playing the video.
flvtool2 -U output.flv
Now play it with JW Player. You should be able to seek around in the movie before the whole clip is downloaded. I think this is all you need to do, but I haven't tested this.
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.