JPEG Image Decoding

General Example

The section provides an example for decoding a JPEG image file to YUV 420p with no image size scaling.

The example requires the following plug-in(s).
  • mjpeg_omx
The following code block shows the example in general.
ffmpeg -nostdin -nostats -c:v mjpeg_omx -omx_pix_fmt yuv420p -i JPG_3840_2160_420.jpg ff_JPG_3840_2160_i420_scale.yuv -hide_banner -y -v verbose

Scenarios

The following code block provides examples in different scenarios.
  • Output YUV with NV12 format, scale width to 1/2, and scale height to 1/2:
    ffmpeg -nostdin -nostats -c:v mjpeg_omx -omx_pix_fmt nv12 -scale_width 1 -scale_height 1 -i MJPEG_3840_2160_444.mjpeg ff_MJPEG_1920_1080_nv12_scale.yuv -hide_banner -y -v verbose
  • Output YUV with NV16 format:
    ffmpeg -c:v mjpeg_omx -omx_pix_fmt nv16 -i JPG_3840_2160_444.jpg ff_JPG_3840_2160_nv16.yuv -hide_banner -y -v verbose
  • Output YUV with NV12 format and mirror horizontal:
    ffmpeg -nostdin -nostats -c:v mjpeg_omx -omx_pix_fmt nv12 -mirror 2 -i MJPEG_3840_2160_444.mjpeg ff_MJPEG_3840_2160_nv12_scale.yuv -hide_banner -y -v verbose
  • Output YUV with NV12 format and rotate 90 degrees:
    ffmpeg -nostdin -nostats -c:v mjpeg_omx -omx_pix_fmt nv12 -rotation 1 -i MJPEG_3840_2160_444.mjpeg ff_MJPEG_2160_3840_nv12_scale.yuv -hide_banner -y -v verbose
  • Output YUV with crop at x:800 y:800 width:800 height:800:
    ffmpeg -c:v mjpeg_omx -crop 800,800,800,800 -i JPG_3840_2160_444.jpg ff_JPG_800_800_crop.yuv -hide_banner -y
    Note: The crop width and height must be a value of 16 multiples.