FFMpeg Mobile video encoding stutter

2019-07-24 06:12发布

问题:

I have been playing around with ffmpeg and video encoding and even though my mp4's work great on desktop, they are smooth etc they are terrible on mobile devices. They stutter and load very slowly and I am trying to figure out the problem.

As an example I made a page using the media element plugin: http://mediaelementjs.com/ and on it I first placed the video that comes with mediaelementjs and it worked well, it scaled to desktop and mobile and loaded quickly and played without any stutter.

However I loaded my video and it was slow and full of stutter, but only on mobile. So I thought it might be S3 (where it is hosted) but saved the file locally and same thing.

I am hoping someone who knows h.264 and/or ffmpeg can point me in the direction of why; here is the current command I am running on ffmpeg:

ffmpeg -i $input_file_name -vcodec libx264 -r 100 -bt 300k -ac 2 -ar 48000 -ab 192k -strict -2 -y $output_temp_file 2>&1

So what have I missed?

回答1:

So what have I missed?

Mobile devices have a very limited computing power. You are trying to play 100fps video file - there aren't any mobile device i know that can handle such framerate.

First - change framerate to reasonable value, then adjust resolution, set encoding profile (baseline, for example), video bitrate (quality, rate-factor). After that you can try out your files.