我将把 GRAY 或 YUV400 视频文件转码为 AVI (YUV420P)。我的输入文件只有 1920x1080 Y,其大小为 22809600 => 11 帧。我使用了以下命令行,但 ffmpeg 生成的 AVI 只有 1 帧。请注意,我还使用了“gray”作为输入pix_fmt
。
您有什么诀窍可以做到这一点,或者这是 ffmpeg 的一个错误?
ffmpeg -s 1920x1080 -pix_fmt pal8 -i YFrames_stub_1920x1080.y -c:v rawvideo -pix_fmt yuv420p YFrames_stub_1920x1080_Y.avi
ffmpeg version N-58949-g0e575c2 Copyright (c) 2000-2013 the FFmpeg developers
built on Dec 9 2013 22:06:49 with gcc 4.8.2 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib
--enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray
--enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
libavutil 52. 58.100 / 52. 58.100
libavcodec 55. 45.100 / 55. 45.100
libavformat 55. 22.100 / 55. 22.100
libavdevice 55. 5.102 / 55. 5.102
libavfilter 3. 92.100 / 3. 92.100
libswscale 2. 5.101 / 2. 5.101
libswresample 0. 17.104 / 0. 17.104
libpostproc 52. 3.100 / 52. 3.100
Input #0, image2, from 'YFrames_stub_1920x1080.y':
Duration: 00:00:00.04, start: 0.000000, bitrate: N/A
Stream #0:0: Video: rawvideo, pal8, 1920x1080, 25 tbr, 25 tbn, 25 tbc
File 'YFrames_stub_1920x1080_Y.avi' already exists. Overwrite ? [y/N] y
Output #0, avi, to 'YFrames_stub_1920x1080_Y.avi':
Metadata:
ISFT : Lavf55.22.100
Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 1920x1080, q=2-31, 200 kb/s, 25 tbn, 25 tbc
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo -> rawvideo)
Press [q] to stop, [?] for help
frame= 1 fps=0.0 q=0.0 Lsize= 3043kB time=00:00:00.04 bitrate=623221.2kbits/s
video:3038kB audio:0kB subtitle:0 global headers:0kB muxing overhead 0.183449%
答案1
经过对该主题的一些实验,我发现了我的错误所在!在命令行中我使用了:
ffmpeg -s 1920x1080 -pix_fmt pal8 -i YFrames_1920x1080.y -c:v rawvideo -pix_fmt yuv420p out.avi
缺少一些参数,但更重要的是-f rawvideo
。如果我在cmd开头添加它:
ffmpeg -f rawvideo -pix_fmt pal8 -s:v 1920x1080 -i YFrames_1920x1080.y -c:v rawvideo -pix_fmt yuv420p out.avi
我们可以同时使用pix_fmt
gray或pal8。