[FFmpeg-user] The efficacy of speed up a .ts file

Champion championch1805 at gmail.com
Thu May 11 06:04:44 EEST 2017


Hi ffmpeg members,

Recently, I have a job to make a speed up mp4 file, and I'm lack of video
knowledge,
so I suffer some issue, below is the command I used:

[1] trim ts file
     ffmpeg -ss 2 -i input.ts -t 5 -vcodec copy -acodec copy output.ts

[2] merge ts file
     ffmpeg -i concat:input1.ts|input2.ts|inputN.ts -y -c copy -bsf:a
aac_adtstoasc output.mp4

[3] speed up 2x and output a mp4 file
     ffmpeg -i input.mp4 -y -filter:v fps=30, setpts=0.5*PTS -an output.mp4

The issue are below:
1. I use JAVA to call the ffmpeg command, and the command [3] is too slow,
    I run my code in AWS EC2(c3.xlarge) and input a 6min30sec .mp4 video,
    the process time about 250 sec, do I have some idea to speed up the
process time?

    - I change input and output to .ts file, [3] just cost 1/6 time which
compare to output .mp4 file,
      but the output quality is down(although they are the same pixel rate
1280x720),
      is this cause by speed up .ts file will lose I frame?

    - I try to add "-preset ultrafast" , the process time will become about
40 sec, but we think this still too slow, do you have some idea to improve
this?

2. When ffmpeg is running, the CPU rate is too high.
    my server(4 core) just run one [3] command, the CPU rate almost
250-300%,
    how can I optimize the cost?

    - I try to use "-threads 1", the CPU rate down to 90-100%, but the
process time is slower.

We want to develop this speed up model as a service, but the process speed
and CPU rate are not good for a service,
do you have some suggest for us?

Many thanks.

Best regards,
Champion Chen


More information about the ffmpeg-user mailing list