Convert mp4 to maximum mobile supported MP4 using

2019-03-08 04:13发布

I would like to use ffmpeg to convert an mp4 to 'low size' mp4 ...

I need an mp4 file with h263 video and aac audio (or some other settings supported by low cost mobile.) My main concern is that the video be playable on most devices.

What would be some possible ffmpeg commands to accomplish this?

Thanks in advance.

1条回答
不美不萌又怎样
2楼-- · 2019-03-08 04:44

There are numerous ways to encode mp4 videos, and encoding them for mobile devices is even more complex. I'm not sure what you mean by "low cost mobile" do you mean low cost as in the device, or the bandwidth needed to play said video?

Either way, here a post to get you going: H.264 WEB VIDEO ENCODING TUTORIAL WITH FFMPEG

Examples

Here are some ffmpeg examples from the post ...

“Standard” web video (480p at 500kbit/s):

ffmpeg -i input_file.avi -vcodec libx264 -vprofile high -preset slow -b:v 500k -maxrate 500k -bufsize 1000k -vf scale=-1:480 -threads 0 -acodec libvo_aacenc -b:a 128k output_file.mp4

360p video for older mobile phones (360p at 250kbit/s in baseline profile):

ffmpeg -i inputfile.avi -vcodec libx264 -vprofile baseline -preset slow -b:v 250k -maxrate 250k -bufsize 500k -vf scale=-1:360 -threads 0 -acodec libvo_aacenc -ab 96k output.mp4

480p video for iPads and tablets (480p at 400kbit/s in main profile):

ffmpeg -i inputfile.avi -vcodec libx264 -vprofile main -preset slow -b:v 400k -maxrate 400k -bufsize 800k -vf scale=-1:480 -threads 0 -acodec libvo_aacenc -ab 128k output.mp4

High-quality SD video for archive/storage (PAL at 1Mbit/s in high profile):

ffmpeg -i inputfile.avi -vcodec libx264 -vprofile high -preset slower -b:v 1000k -vf scale=-1:576 -threads 0 -acodec libvo_aacenc -ab 196k output.mp4

Bitrates, scale and profiles ...

From the examples there, some of the key things you might need to pay attention to are ...

-b:v 500k

-b:a 128k

Those are bitrates of the video v and audio a, the lower the number the lower the quality but also the better it might 'play' on a low end device.

scale=-1:480

That will scale the video down to a smaller size, see more info about that in the post)

-vprofile baseline

This seemly odd baseline (or another appropriate profile parameter) can be important when encoding for certain lower-cost (e.g. Android) devices ...

Baseline Profile (BP)

Primarily for low-cost applications that require additional data loss robustness, this profile is used in some videoconferencing and mobile applications. This profile includes all features that are supported in the Constrained Baseline Profile, plus three additional features that can be used for loss robustness (or for other purposes such as low-delay multi-point video stream compositing). The importance of this profile has faded somewhat since the definition of the Constrained Baseline Profile in 2009. All Constrained Baseline Profile bitstreams are also considered to be Baseline Profile bitstreams, as these two profiles share the same profile identifier code value.

查看更多
登录 后发表回答