使用ffmpeg缩放AppStore的应用预览视频 [英] Using ffmpeg to scale app preview videos for the AppStore
问题描述
我正在生成一个应用预览视频,以发送到AppStore.根据设备类型,AppStore需要某些视频分辨率.
I'm generating an app preview video to send to the AppStore. Depending on the device type, the AppStore requires certain video resolutions.
我有一个主视频,分辨率为1920x1080,可以上传.
I have a main video, with resolution 1920x1080, which I was able to upload.
我需要生成另一个分辨率为1920x886的视频以支持6.5设备,因此我使用以下命令执行缩放:
I need to generate another video with the resolution 1920x886 for supporting 6.5" devices, so I used the following command to perform the scaling:
ffmpeg -i video_1920_1080.mp4 -vf scale=1920:886 -c:a copy video_1920_886.mp4
如果使用ffmpeg -i获取有关生成的视频的信息,则会得到以下结果:
If I get the info for the generated video using ffmpeg -i I get the following result:
ffmpeg -i video_1920_886.mp4
ffmpeg version 3.4.2 Copyright (c) 2000-2018 the FFmpeg developers
built with Apple LLVM version 9.0.0 (clang-900.0.39.2)
configuration: --prefix=/usr/local/Cellar/ffmpeg/3.4.2 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --disable-jack --enable-gpl --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --enable-videotoolbox --disable-lzma
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libavresample 3. 7. 0 / 3. 7. 0
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'hittin_1920_886.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.83.100
Duration: 00:00:29.13, start: 0.000000, bitrate: 705 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x886 [SAR 443:540 DAR 16:9], 694 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Metadata:
handler_name : VideoHandler
timecode : 00:00:10:20
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 2 kb/s (default)
Metadata:
handler_name : SoundHandler
Stream #0:2(eng): Data: none (tmcd / 0x64636D74), 0 kb/s
Metadata:
handler_name : TimeCodeHandler
timecode : 00:00:10:20
好,所以输出的视频似乎具有正确的1920x886分辨率.
Ok, so it seems the output video is in the correct 1920x886 resolution.
但是,当我尝试上传该视频时,AppStore抱怨该视频的分辨率不正确.
However, when I try to upload this video the AppStore complains that the video is in the incorrect resolution.
如果我在macOS上打开文件属性窗口,则同一视频将显示以下信息:
If I open the file properties window on macos, the following information appears for the same video:
而且,如果我在VLC上打开同一视频,则可以在媒体信息"屏幕上看到以下信息:
And, if I open the same video on VLC, I can see the following info on the Media Info screen:
所以:
- ffmpeg -i告诉我视频的分辨率为1920x886.
- macos文件属性告诉我视频的分辨率为1575x886.
- VLC告诉我该视频的分辨率为1920x898,显示分辨率为1920x886.
为什么有三种不同的分辨率?我该如何更改它们中的每一个?我想appstoreconnect网站期望文件属性分辨率为1920x886.我该如何更改?
Why are there three different resolutions? How can I change each one of them? I suppose the appstoreconnect website expects the file properties resolution to be 1920x886. How can I change that?
推荐答案
FFmpeg的比例过滤器将调整视频的采样宽高比,从而保留原始的显示比例.显然,苹果公司使用该SAR计算了新的有效显示分辨率.
FFmpeg's scale filter will adjust the sample aspect ratio of the video so that the original display ratio is preserved. Apple, apparently, computes the new effective display resolution using that SAR.
插入setsar
滤波器将SAR重置为1,以使显示分辨率与存储的分辨率相同.
Insert a setsar
filter to reset the SAR to 1, so that the display resolution is the same as the stored resolution.
ffmpeg -i video_1920_1080.mp4 -vf scale=1920:886,setsar=1 -c:a copy video_1920_886.mp4
这篇关于使用ffmpeg缩放AppStore的应用预览视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!