简体   繁体   English

FFmpeg mp4压缩

[英]FFmpeg mp4 compression

I'm developing photo and video social network ( partially like instagram ). 我正在开发照片和视频社交网络(部分类似于instagram)。 And i'm using ffmpeg for mp4 to mp4 file size compression. 而且我正在将ffmpeg用于mp4到mp4文件大小的压缩。 I achieved 3 time scale factor for file size ( from 13 mb to 2,5 mb ) but very stupidly - 3 times converting output files by the following command-line string : 我实现了文件大小的3个时间标度因子(从13 mb到2,5 mb),但非常愚蠢-通过以下命令行字符串将输出文件转换3次:

./ffmpeg -i input.mp4 -vcodec h264 -acodec mp2 output.mp4

I'm a newbee in video-audio codec theory, so i completely lost audio while such compression. 我是视音频编解码器理论的新手,因此在进行此类压缩时我完全失去了音频。 So my question is - where is audio? 所以我的问题是-音频在哪里? Which option should i use? 我应该使用哪个选项? Thanks in advance! 提前致谢!

MP2 is MPEG-1 Layer 2 audio codec, not expected by many players in a MP4 container. MP2是MPEG-1第2层音频编解码器,MP4容器中的许多播放器都不希望使用。 Use AAC or MP3 instead. 请改用AAC或MP3。

The command below will use the default codecs (H264 and AAC): 以下命令将使用默认编解码器(H264和AAC):

ffmpeg -i input.mp4 output.mp4

For web use, you should include the following two, to be safe: 为了网络使用,为了安全起见,应包括以下两项:

ffmpeg -i input.mp4 -pix_fmt yuv420p -movflags +faststart output.mp4

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM