Thursday, June 17, 2010

Playing with video files in Linux

1. To extract audio from a video file --

$ mplayer my_video_file.avi -ao pcm:file=file.wav

$ lame -f file.wav file.mp3

This creates a small size high quality mp3 file but it is very slow particularly if extracting the entire audio track of a movie. Mplayer takes ages to do the extraction. SO, it is better to use ffmpeg instead.

$ ffmpeg -i my_video_file.avi extracted_audio.mp3
2. Convert any audio format to wav/mp3 --
$ mplayer file.rm -ao pcm:file=file.wav
$ lame -f file.wav file.mp3
 3. Convert any video format to avi --

FLV to mpg :

Using ffmpeg :
  • libavcodec is a library containing all the FFmpeg audio/video encoders and decoders. Most codecs were developped from scratch to ensure best performances and high code reusability.
  • libavformat is a library containing parsers and generators for all common audio/video formats.

$ ffmpeg -i jokes.flv -ab 56 -ar 22050 -b 500 -s 320×240 jokes.mpg

jokes.flv is the file you want to convert, so the name must be the same as the source file.You can name jokes.mpg whatever you want as long as it has the .mpg extension.
-b bitrate: set the video bitrate in kbit/s (default = 200 kb/s)
-ab bitrate: set the audio bitrate in kbit/s (default = 64)
-ar sample rate: set the audio samplerate in Hz (default = 44100 Hz)
-s size: set frame size. The format is WxH (default 160×128 )



 ---- to be continued ---

No comments:

OK GOOGLE on Samsung Galaxy S7 doesn’t work

To make Ok Google detection work on Galaxy S7 (Galaxy series phones) we need to perform a couple of steps. 1. As long as Samsung S vo...