我有一系列图像想要转换成视频。图像格式如下:
Dimensions: 3840 x 2160
Width: 3840 pixels
Height: 2160 pixels
Horizontal Resolution: 30 dpi
Vertical Resolution: 72 dpi
Bit Depth: 24
ffmpeg -framerate 23.976000 -i woa%04d.jpg -i original-audio.wav -c:v libx265 -crf 15 -preset ultrafast -pix_fmt yuv444p -c:a copy Output.mkv
我遇到的问题是 JPG 文件被渲染成正方形,破坏了原始的纵横比。
我还尝试了以下操作:
ffmpeg -framerate 23.976000 -i woa%04d.jpg -i original-audio.wav -c:v libx265 -crf 15 -preset ultrafast -pix_fmt yuv444p -vf scale=3840:2160:force_original_aspect_ratio=decrease -c:a copy Output.mkv
有人有什么建议吗?
这是输出ffmpeg -i woa%04d.jpg
这是我得到的:
ffmpeg version N-94357-g4373bb411c Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 9.1.1 (GCC) 20190716
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
libavutil 56. 30.100 / 56. 30.100
libavcodec 58. 53.101 / 58. 53.101
libavformat 58. 28.102 / 58. 28.102
libavdevice 58. 7.100 / 58. 7.100
libavfilter 7. 56.101 / 7. 56.101
libswscale 5. 4.101 / 5. 4.101
libswresample 3. 4.100 / 3. 4.100
libpostproc 55. 4.100 / 55. 4.100
Input #0, image2, from 'woa%04d.jpg':
Duration: 00:03:43.32, start: 0.000000, bitrate: N/A
Stream #0:0: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 3840x2160 [SAR 30:72 DAR 20:27], 25 fps, 25 tbr, 25 tbn, 25 tbc
At least one output file must be specified```
答案1
ffmpeg 将输入视为具有 20:27 的显示比例。如果不希望如此,您可以将宽高比重置为 1。
ffmpeg -framerate 24000/1001 -i woa%04d.jpg -i original-audio.wav -vf setsar=1 -c:v libx265 -crf 15 -preset ultrafast -pix_fmt yuv444p -c:a copy Output.mkv