FFMPEG는 원시 비디오 픽셀 형식을 변환합니다.

FFMPEG는 원시 비디오 픽셀 형식을 변환합니다.

원시 uyvy422 비디오 스트림이 있고 이를 yuv420p 스트림으로 변환하려고 합니다. 필요한 경우 FFMPEG가 색상 공간을 h264로 변환한다는 점을 고려하면 이것이 가능하다고 생각했습니다.

$ffmpeg \
-f rawvideo -pixel_format uyvy422 -video_size 1920x1080 -i test.uyvy422 \
-f rawvideo -pixel_format yuv420p -video_size 1920x1080 uyvy_to_yuv.420p

산출:

ffmpeg version 3.2.14-1~deb9u1 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
  configuration: --prefix=/usr --extra-version='1~deb9u1' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libebur128 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  libavutil      55. 34.101 / 55. 34.101
  libavcodec     57. 64.101 / 57. 64.101
  libavformat    57. 56.101 / 57. 56.101
  libavdevice    57.  1.100 / 57.  1.100
  libavfilter     6. 65.100 /  6. 65.100
  libavresample   3.  1.  0 /  3.  1.  0
  libswscale      4.  2.100 /  4.  2.100
  libswresample   2.  3.100 /  2.  3.100
  libpostproc    54.  1.100 / 54.  1.100
[rawvideo @ 0x560821593f20] Estimating duration from bitrate, this may be inaccurate
Input #0, rawvideo, from 'test.uyvy422':
  Duration: 00:00:00.60, start: 0.000000, bitrate: 829440 kb/s
    Stream #0:0: Video: rawvideo (UYVY / 0x59565955), uyvy422, 1920x1080, 829440 kb/s, 25 tbr, 25 tbn, 25 tbc
Output #0, rawvideo, to 'uyvy_to_yuv.420p':
  Metadata:
    encoder         : Lavf57.56.101
    Stream #0:0: Video: rawvideo (UYVY / 0x59565955), uyvy422, 1920x1080, q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc
    Metadata:
      encoder         : Lavc57.64.101 rawvideo
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> rawvideo (native))
Press [q] to stop, [?] for help
frame=   15 fps=0.0 q=-0.0 Lsize=   60750kB time=00:00:00.60 bitrate=829440.0kbits/s speed=7.66x

보시다시피 입력 스트림은 uyvy422이고 출력도 uyvy422입니다.

답변1

-pixel_formatrawvideo demuxer의 입력 옵션입니다. 사용 -pix_fmt.

$ffmpeg \
-f rawvideo -pixel_format uyvy422 -video_size 1920x1080 -i test.uyvy422 \
-f rawvideo -pix_fmt yuv420p -s 1920x1080 uyvy_to_yuv.420p

관련 정보