无法使用 quicktime 打开 ffmpeg 输出,pix_fmt 标志无法修复
Can't open ffmpeg output with quicktime, pix_fmt flag doesn't fix it
当我尝试制作动画时,Quicktime 无法读取 ffmpeg
的输出。它上传到 imgur 并播放没有问题。 previous thread 建议我添加 -pix_fmt yuv420p
标志。但是,在我的系统上,这不起作用。 ffmpeg
当我排除 pix_fmt
标志时运行没有错误,但我无法在 quicktime 中打开输出动画。
为什么quicktime打不开动画?如何让动画用quicktime打开?
$ ffmpeg -y -i animation/tigers_${ii}_%05d.png -pix_fmt yuv420p tiger${ii}.mp4
ffmpeg version 4.0.2 Copyright (c) 2000-2018 the FFmpeg developers
built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.0.2 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-gpl --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --enable-videotoolbox --disable-lzma
libavutil 56. 14.100 / 56. 14.100
libavcodec 58. 18.100 / 58. 18.100
libavformat 58. 12.100 / 58. 12.100
libavdevice 58. 3.100 / 58. 3.100
libavfilter 7. 16.100 / 7. 16.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 1.100 / 5. 1.100
libswresample 3. 1.100 / 3. 1.100
libpostproc 55. 1.100 / 55. 1.100
Input #0, image2, from 'animation/tigers_1.10_%05d.png':
Duration: 00:00:08.32, start: 0.000000, bitrate: N/A
Stream #0:0: Video: png, rgba(pc), 2023x3036 [SAR 17716:17716 DAR 2023:3036], 25 fps, 25 tbr, 25 tbn, 25 tbc
Stream mapping:
Stream #0:0 -> #0:0 (png (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[libx264 @ 0x7fdd7b800c00] width not divisible by 2 (2023x3036)
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
Conversion failed!
错误很明显,
[libx264 @ 0x7fdd7b800c00] width not divisible by 2 (2023x3036)
使用裁剪滤镜去除一列像素:
ffmpeg -y -i animation/tigers_${ii}_%05d.png -vf "crop='iw-mod(iw,2)':'ih-mod(ih,2)',format=yuv420p" tiger${ii}.mp4
-pix_fmt
选项相当于添加格式过滤器作为最后一个过滤器。
当我尝试制作动画时,Quicktime 无法读取 ffmpeg
的输出。它上传到 imgur 并播放没有问题。 previous thread 建议我添加 -pix_fmt yuv420p
标志。但是,在我的系统上,这不起作用。 ffmpeg
当我排除 pix_fmt
标志时运行没有错误,但我无法在 quicktime 中打开输出动画。
为什么quicktime打不开动画?如何让动画用quicktime打开?
$ ffmpeg -y -i animation/tigers_${ii}_%05d.png -pix_fmt yuv420p tiger${ii}.mp4
ffmpeg version 4.0.2 Copyright (c) 2000-2018 the FFmpeg developers
built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.0.2 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-gpl --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --enable-videotoolbox --disable-lzma
libavutil 56. 14.100 / 56. 14.100
libavcodec 58. 18.100 / 58. 18.100
libavformat 58. 12.100 / 58. 12.100
libavdevice 58. 3.100 / 58. 3.100
libavfilter 7. 16.100 / 7. 16.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 1.100 / 5. 1.100
libswresample 3. 1.100 / 3. 1.100
libpostproc 55. 1.100 / 55. 1.100
Input #0, image2, from 'animation/tigers_1.10_%05d.png':
Duration: 00:00:08.32, start: 0.000000, bitrate: N/A
Stream #0:0: Video: png, rgba(pc), 2023x3036 [SAR 17716:17716 DAR 2023:3036], 25 fps, 25 tbr, 25 tbn, 25 tbc
Stream mapping:
Stream #0:0 -> #0:0 (png (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[libx264 @ 0x7fdd7b800c00] width not divisible by 2 (2023x3036)
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
Conversion failed!
错误很明显,
[libx264 @ 0x7fdd7b800c00] width not divisible by 2 (2023x3036)
使用裁剪滤镜去除一列像素:
ffmpeg -y -i animation/tigers_${ii}_%05d.png -vf "crop='iw-mod(iw,2)':'ih-mod(ih,2)',format=yuv420p" tiger${ii}.mp4
-pix_fmt
选项相当于添加格式过滤器作为最后一个过滤器。