[FFmpeg-user] How to convert video.ts to video.mp4 efficiently?

Bo Berglund bo.berglund at gmail.com
Thu Apr 15 13:30:51 EEST 2021

On Wed, 14 Apr 2021 16:03:31 +0200, Moritz Barsnick <barsnick at gmx.net> wrote:

>On Tue, Apr 13, 2021 at 17:49:55 +0200, Bo Berglund wrote:
>> Question:
>> Is there a quicker way to just go from ts to mp4 so the file format is OK even
>> though the video size remains at 1280x720?
>> (I could live with the size even though the disk storage takes a hit...)
>Yes, by remuxing, i.e. using the "copy" codec for video as well:
>$ ffmpeg -i %INFILE% -c copy %OUTFILE%
>or, as Carl suggested:
>$ ffmpeg -i %INFILE% -c copy -movflags +faststart %OUTFILE%
>As mentioned, the suffix .mp4 already implies the format you are trying
>to achieve.

I tried this suggestion
$ ffmpeg -i %INFILE% -c copy -movflags +faststart %OUTFILE%

and it resulted in a 2-pass operation, the first took a bit over 1 minute and
then there was an operation wehere the "moov atom" is moved to the front of the
file, took about the same time.

So in all about 2+ minutes rather than 10, a good improvement.
But now I have an mp4 file that is about 1.3 GB whereas they are about 450 MB
when I also cut down the size. Which takes about 10-11 minutes.

I have changed my script command which scales down the size so instead of going
to 480p I am now  going to 360p, which is an even number operation regarding
pixels (1/2 in both directions), should improve processing.
With this the size conversion from 1280x720 to 640x360 takes 6-8 minutes rather
than 10-12 before.

I have to make up my mind what is the best compromize here.

Bo Berglund
Developer in Sweden

More information about the ffmpeg-user mailing list