Wednesday, August 25, 2010

Convert .ts files to .avi

I use this command to convert .ts files recorded from a Blusens T50 device to .avi format in Debian Lenny (with debian-multimedia repositories included):

ffmpeg -i input_file.ts -vcodec libxvid -b 2000k -acodec libmp3lame -ac 2 -ar 44100 -ab 128k output_file.avi

Result .avi files play fine in a wide range of devices.

To increase or decrease video quality you can use a higher or lower value in -b option.

You can select start point and duration of the encoding with -ss and -t options. For example, to encode 30 seconds starting at the minute 10 you can type:

ffmpeg -i input_file.ts -ss 00:10:00 -t 00:00:30 -vcodec libxvid -b 2000k -acodec libmp3lame -ac 2 -ar 44100 -ab 128k output_file.avi


Therefore, to choose the second audio stream instead of the first, you can use the -map option:

ffmpeg -i input_file.ts -vcodec libxvid -b 2000k -map 0:0 -map 0:2 -acodec libmp3lame -ac 2 -ar 44100 -ab 128k output_file.avi


(the first -map choose the video stream and the second one the second audio stream)

1 comments:

Anonymous said...

Just what I was looking for, thanks!