Convert FLV into MPG
This is howto convert flash video into an mpg video file format on your Linux box without any quality loss. Trying to directly convert an FLV with FFMPEG can create a sound sync problem. It probably will not show on short clips, but on a full length film it can happen. Converting to a pure intermediate format used for professional video is not a bad technique. It is true that simpler methods exist, but with the poor quality of many source *.flv videos, anything to improve quality is a bonus. The technique described, has many other uses, so keep reading. It is not just applicable for converting *.flv, it can be used to solve other problems.
This does not work, it can create a sound sync problem
It is also wrong because it uses -sameq which does NOT mean "same quality"
# W R O N G !
ffmpeg -i "YouTube-Clip.flv" -sameq "Converted-YouTubeClip.mpg"
Solving the Sound Synch
The solution is to convert into an intermidate format that merges the separate sound track with the picture. Such a format is DV.
DV is a format for recording video with the audio is stored uncompressed. The picture uses very limited compression. In plain english, its for high quality video recording and editing, used by professionals and the likes of the BBC. It is big, but it is quality, which is why it is used for recording TV by journalists.
ffmpeg -i "YouTube-Clip.flv" -s pal -r pal -aspect 16:9 -ar 48000 "YouTubeClip.dv"
ffmpeg -i "YouTube-Clip.dv" -sameq "Converted-YouTubeClip.mpg"
This creates a rather large temporary intermediate file. A typical 8 min YouTube clip will create a 2.2Gb DV File. You have to wait while this large temp file is created, and then wait for it to encoded into mpg.
A better faster cleaner solution
The Named Pipe speeds things up, no waiting for an intermediate temp file.
#Using Pipe for speed and efficency
ffmpeg -i "my_movie.flv" -s pal -r pal -aspect 4:3 -ar 48000 -target dv - > ".temp.dv" < /dev/null &
ffmpeg -i ".temp.dv" -sameq "my_movie.mpg" < /dev/null
#kdialog --passivepopup "Finished converting FLV Video" 15
Note the last command is optional. If you have KDE, it will tell you its finished in a cool dialog box, which disolves after 15 seconds.
Americans have NTSC TV standard not PAL .So replace -pal with -ntsc like this :
ffmpeg -i "my_movie.flv" -s ntsc -r ntsc -aspect 4:3 -ar 48000 -target dv - > ".temp.dv" < /dev/null &
You can also target DVD by changing the target to -target dvd-pal like this :
ffmpeg -i "my_movie.flv" -s ntsc -r ntsc -aspect 4:3 -ar 48000 -target dvd-dv - > ".temp.dv" < /dev/null &
To e-mail me, send it to "eye" at this domain.
DV Format http://en.wikipedia.org/wiki/DV
MPEG Format http://en.wikipedia.org/wiki/H.262/MPEG-2
FLV Format (Flash Video) http://en.wikipedia.org/wiki/Flash_Video