使用 FFMPEG 将 mp4 转换为最大移动支持的 MP4 [英] Convert mp4 to maximum mobile supported MP4 using FFMPEG

查看:59
本文介绍了使用 FFMPEG 将 mp4 转换为最大移动支持的 MP4的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用 ffmpegmp4 转换为低尺寸"mp4 ...

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

我需要一个 mp4 文件,其中包含 h263 视频和 aac 音频(或低成本移动设备支持的一些其他设置.)我主要关心的是是视频可以在大多数设备上播放.

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.

什么是可能的 ffmpeg 命令来完成这个?

What would be some possible ffmpeg commands to accomplish this?

提前致谢.

推荐答案

MP4 视频的编码方法有很多种,而移动设备的编码方法则更为复杂.我不确定您所说的低成本移动设备"是指设备中的低成本,还是播放所述视频所需的带宽?

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?

无论哪种方式,这里都有一篇文章可以帮助您:使用 FFMPEG 的 H.264 网络视频编码教程

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

以下是帖子中的一些 ffmpeg 示例...

Here are some ffmpeg examples from the post ...

标准"网络视频(480p 500kbit/s):

"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 -threads0 -acodec libvo_aacenc -b:a 128k output_file.mp4

适用于较旧手机的 360p 视频(基线为 250kbit/s 时为 360p个人资料):

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

适用于 iPad 和平板电脑的 480p 视频(主要配置文件中为 480p 400kbit/s):

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

用于存档/存储的高品质标清视频(PAL at 1Mbit/s in high个人资料):

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

ffmpeg -i inputfile.avi -vcodec libx264 -vprofile high -preset slow -b:v 1000k -vf scale=-1:576 -threads 0 -acodec libvo_aacenc -ab196k 输出.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

那些是视频 v 和音频 a 的比特率,数字越低质量越低,但在低端设备上播放"的效果也越好.

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(或其他合适的配置文件参数)可以在为某些低成本(例如 Android)设备编码时很重要...

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

基线资料 (BP)

主要用于需要额外数据丢失的低成本应用健壮性,此配置文件用于某些视频会议和移动应用程序.此配置文件包括支持的所有功能约束基线配置文件,以及三个附加功能可用于损失鲁棒性(或用于其他目的,例如低延迟多点视频流合成).的重要性自从定义了2009 年的受限基线配置文件.所有受限基线配置文件比特流也被认为是基线配置比特流,如这两个配置文件共享相同的配置文件标识符代码值.

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.

这篇关于使用 FFMPEG 将 mp4 转换为最大移动支持的 MP4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆