[FFmpeg-user] JPG/PNG images render in incorrect orientation in MP4 output file and can't be combined in same MP4 video
mark at d3memories.com
Thu Jul 8 22:36:36 EEST 2021
Greetings, FFMpeg Users!
I am a new user to FFMpeg.
I want a command-line that will create a basic slideshow MP4 video from a folder of JPG and/or PNG images. The images are sourced from either digital cameras/smartphones or scanned photos (typically 600 dpi).
I have been partially successful so far by creating an input text file with a list of the image filenames from the folder with a "duration 2" command after each "file" statement to introduce a 2 second delay between each image.
ffmpeg -hide_banner -f concat -safe 0 -I test-ffmpeg.Txt -c:v libx264 -r 30 -pix_fmt yuv420p test-ffmpeg.mp4
I have noticed two strange behaviors.
All images in the MP4 output file are rendered either in portrait or landscape orientation depending on the orientation of the first image. And because I have a mix of portrait and landscape images in the folder, the images that are rendered in the incorrect orientation are stretched or squashed. So if the first image is portrait, all images render as portrait. If the first image is landscape, all images are rendered as landscape.
Is there a way to get the images to render in their correct orientation?
I can't mix both JPG and PNG image files in the same input text file. I receive several errors:
invalid data found when processing input
cannot process SOS before SOF, skipping
unsupported coding type (ca)
However, if I separate the JPG and PNG files into separate JPG or PNG input files and run them separately, both image types render correctly.
More information about the ffmpeg-user