Image Soft Encoding and Transcoding
The topic provides examples for soft encoding an image file and transcoding.
The following code block shows the example in different scenarios.
- Encode a YUV file to JPG:
ffmpeg -s 1920*1080 -pix_fmt yuv444p -i output-big_big_image-1920-1080.yuv output-big_big_image-1920-1080.jpg
- Encode a YUV file to PNG:
ffmpeg -s 1280*720 -pix_fmt yuv444p -i output-big_big_image-1280-720.yuv out-put-big_big_image-1280-720.png
- Encode a YUV file to BMP:
ffmpeg -s 640*480 -pix_fmt yuv444p -i output-big_big_image-640-480.yuv output-big_big_image-640-480.bmp
- Encode a RGB file to JPG:
ffmpeg -s 640*960 -pix_fmt rgba -i output_640_960.rgb output_640_960.jpg
- Encode a RGB file to PNG:
ffmpeg -s 640*960 -pix_fmt rgba -i output_640_960.rgb output_640_960.png
- Encode a RGB file to BMP:
ffmpeg -s 640*960 -pix_fmt rgba -i output_640_960.rgb output_640_960.bmp
- Transcode a JPG file to PNG:
ffmpeg -i big_big_image.jpg big_big_image.png
- Transcode a JPG file to BMP:
ffmpeg -i big_big_image.jpg big_big_image.bmp
- Transcode and scale to a specific size:
ffmpeg -i big_big_image.jpg -vf scale=320:240 big_big_image_320_240.jpg
- Transcode and scale to a specific ratio:
ffmpeg -i big_big_image.jpg -vf scale=320:-1 big_big_image_zoom.jpg
- Decode a video file to image sequence:
ffmpeg -i 1080p_h264_aac_cut5s.mp4 -t 5 -s 1920*1080 output-cut-img-%3d.jpg
- Encode an image sequence to video:
ffmpeg -i output-cut-img-%3d.jpg output-jpg.mp4