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

Bo Berglund bo.berglund at gmail.com
Tue Apr 13 18:49:55 EEST 2021


I am downloading video streams from a source that does not suppy alternate
resolutions and is only sending a ts stream.
So the result is that the downloaded files have these problems:

1) They are the original resolution: 1280x720 px but I prefer a 480p size

2) They are in ts format rather than mp4

When I want to view them through my website I need them to be in mp4 format as
well as smaller in size (both pixel resolution and file size on disk).

So with advice from here and some other places I have composed the following
commands in my batch script to do the conversion:

SET VSIZE=%~1
SET INFILE=%~2
SET OUTFILE=%~3

set COMMAND=ffmpeg -hide_banner -i %INFILE% -vf scale=w=-4:h=%VSIZE% -c:v
libx264 -preset fast -crf 20 -c:a copy %OUTFILE%

%COMMAND%

This works but it takes about 10 min to convert one 44 min video and meanwhile
the PC runs at almost 100% CPU load.

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...)
Do I just take away this argument:

scale=w=-4:h=%VSIZE%

Is there something else I can do?


-- 
Bo Berglund
Developer in Sweden



More information about the ffmpeg-user mailing list