我正在尝试转换使用 Blackmagic Design Intensity 卡捕获的原始视频帧。输出帧的格式如下:
YCbCr 4:2:2 packed 8 Bit UYVY Abekas
我如何将其转换为更可用的格式?我的目标是将帧提取为图像,将帧集提取为视频。
我尝试使用 FFmpeg 转换文件,但找不到正确的格式。我使用的示例是一个包含单帧原始数据的文件。FFmpeg 转换了文件,但它被扭曲了,所以我知道这意味着我的像素格式不正确。我开始认为 FFmpeg 不支持我需要的像素格式。
ffmpeg -s 720x486 -i snapshot.yuv snapshot.jpg
输出几乎正确但大部分是绿色。
这是 FFmpeg 的输出。检测到的 rawvideo 格式不正确。应该是 Y422,而不是 I420。
ffmpeg version N-64009-g389d453 Copyright (c) 2000-2014 the FFmpeg developers
built on Jun 16 2014 15:43:30 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
configuration:
libavutil 52. 89.100 / 52. 89.100
libavcodec 55. 67.100 / 55. 67.100
libavformat 55. 43.100 / 55. 43.100
libavdevice 55. 13.101 / 55. 13.101
libavfilter 4. 8.100 / 4. 8.100
libswscale 2. 6.100 / 2. 6.100
libswresample 0. 19.100 / 0. 19.100
[rawvideo @ 0x2af1c20] Estimating duration from bitrate, this may be inaccurate
Input #0, rawvideo, from 'snapshot.yuv':
Duration: 00:00:00.04, start: 0.000000, bitrate: 139968 kb/s
Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 720x486, 104976 kb/s, 25 tbr, 25 tbn, 25 tbc
[swscaler @ 0x2ae13e0] deprecated pixel format used, make sure you did set range correctly
Output #0, image2, to 'snapshot.jpg':
Metadata:
encoder : Lavf55.43.100
Stream #0:0: Video: mjpeg, yuvj420p, 720x486, q=2-31, 200 kb/s, 25 fps, 90k tbn, 25 tbc
Metadata:
encoder : Lavc55.67.100 mjpeg
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> mjpeg (mjpeg))
Press [q] to stop, [?] for help
[swscaler @ 0x2ae13e0] Warning: data is not aligned! This can lead to a speedloss
[rawvideo @ 0x2af2ec0] Invalid buffer size, packet size 174960 < expected frame_size 524880
Error while decoding stream #0:0: Invalid argument
frame= 1 fps=0.0 q=7.0 Lsize=N/A time=00:00:00.04 bitrate=N/A
video:140kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown