Playing .avi file

Colin Law clanlaw at googlemail.com
Fri Apr 5 07:50:18 UTC 2013


On 5 April 2013 01:14, JD <jd1008 at gmail.com> wrote:
>
> On 04/04/2013 01:42 PM, Colin Law wrote:
>>
>> On 4 April 2013 18:52, JD <jd1008 at gmail.com> wrote:
>>>
>>> On 04/04/2013 08:24 AM, Colin Law wrote:
>>>>
>>>> On 4 April 2013 09:04, JD <jd1008 at gmail.com> wrote:
>>>>>
>>>>> Using mplayer to play an avi file.
>>>>> the dir where the file resides also contains an srt (subtitles file).
>>>>> The files are named
>>>>> Sams_Journey.avi  and
>>>>> Sams_Journey.srt
>>>>>
>>>>> If I play the avi file with mplayer, the subtitles do appear.
>>>>> However,if I copy the avi file alone to another dir and I
>>>>> play the avi file in that dir, the subtitles do not appear.
>>>>>
>>>>> Is there a way for me to incorporate the subtitles file into the
>>>>> avi file, or (any other format, such as mpg or mp4)?
>>>>
>>>> If you first convert it to an mp4 using ffmpeg or avconv, example,
>>>> then you can add the subtitles using MP4Box
>>>> MP4Box -add file.srt file.mp4
>>>>
>>>> To convert to mp4 I use something like
>>>> avconv -y -i file.avi -vcodec libx264 -pre libx264-medium -crf  22
>>>> -threads 0 file.mp4
>>>> You might have to add something for the audio track, I don't know.
>>>> Mine are video only.  Also you may want to tweak the settings to get
>>>> the quality you require.
>>>>
>>>> There may be better ways, but that is what I do.
>>>>
>>>> Colin
>>>>
>>> Will this work if I only want to convert to mpeg1 format?
>>
>> The commands I posted converts to mp4 and then adds the audio track,
>> so obviously those commands will not convert to mpeg1.  avconv can
>> convert to mpeg1 but MP4Box only works with mp4.  The clue is in the
>> name.
>>
>> Colin
>
> Found on the web this invocation of ffmpeg from ffmpeg.org
> which converts avi to mpg and merges the subs in one command:
>
> ffmpeg -i Canyon_Trip.avi -vf subtitles=Canyon_Trip.srt  -y Canyon_Trip.mpg

You need to use the -b option to specify the video bitrate (and hence
the quality).  The bigger it is the better the quality and the bigger
the file and the slower the conversion.  Of course once you get to a
value greater than your input file it just makes the file bigger with
no increase in quality.  You could start with something like -b
6000000.

Colin




More information about the ubuntu-users mailing list