ffmpeg - 无法使用 quicktime 打开 ffmpeg 输出,pix_fmt 标志无法修复它

标签 ffmpeg quicktime

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选项相当于添加格式过滤器作为最后一个过滤器。

关于ffmpeg - 无法使用 quicktime 打开 ffmpeg 输出,pix_fmt 标志无法修复它,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58810432/

相关文章:

ffmpeg - flash/modules/global/app/ffmpeg.exe 是不可执行的

audio - 3gpp/音频快速时间嵌入

c++ - QTKit 没有找到任何附加的视频输入设备

video - 如何使用 ffmpeg 将 WebM 音频(Opus)和 MP4 视频(H.264)合并为一个 MP4 文件

ffmpeg - 从命令行通过 Fluent-ffmpeg 或 ffmpeg 转码为 opus

audio - 使用 ffmpeg 同步带有音频的视频文件正在返回没有音频的视频

macos - QTMovieView 支持的格式

linux - Linux 上的 Libquicktime 支持

php - 如何在 PHP 中计算视频长度和大小?

ios - 设置带有 FFmpeg 的 Red5 服务器用于直播到 iOS