This is using ffmpeg version 3.4.4-0ubuntu0.18.04.1 on Ubuntu 18.04.
I'd like to achieve the same as in Create video with 5 images with fadeIn/out effect in ffmpeg (mostly "Dip to black", although I'd like to know about "Crossfade" too) - however, I have many files, and would prefer to use absolute paths, and I'm afraid I'll run into some command line limitation if I list each file on the command line.
So, I've found this ( the same is noted on ffmpeg slideshow with crossfade ):
... which mentions:
"A" is the duration in seconds how long each picture is shown (without the crossfade duration), and "B" is the crossfade duration in seconds.
ffmpeg -i IMG_%3d.jpg -vf zoompan=d=(A+B)/B:fps=1/B,framerate=25:interp_start=0:interp_end=255:scene=100 -c:v mpeg4 -maxrate 5M -q:v 2 out.mp4
So, i have these images:
$ ls /path/to/test_*.jpg | wc -l
249
I'd like framerate to be 25 fps, duration of each image without fade: quarter second, 0.25 sec (so 6.25 frames, or floored, 6 frames), and fade duration 4 frames (so 0.16 sec @ 25 fps). So I'd expect at least 249*(6+4) = 2490 frames, or 99.6 sec at 25 fps.
This is the format of the images (from a phone camera):
$ mediainfo /path/to/test_IMG_11a.jpg
General
Complete name : /path/to/test_IMG_11a.jpg
Format : JPEG
File size : 1 001 KiB
Image
Format : JPEG
Width : 3 840 pixels
Height : 2 160 pixels
Color space : YUV
Chroma subsampling : 4:2:2
Bit depth : 8 bits
Compression mode : Lossy
Stream size : 1 001 KiB (100%)
So, I try this command line:
ffmpeg -an -f image2 -pattern_type glob -i '/path/to/test_*.jpg' \
-vf 'fps=25,zoompan=d=(0.25+0.16)/0.16:fps=1/0.16,framerate=25:interp_start=0:interp_end=255:scene=100' \
-vcodec libx264 -pix_fmt yuv420p -profile:v baseline -level 3 \
-y out.mp4
This results with two problems:
The first problem is:
[swscaler @ 0x5582a63a4500] deprecated pixel format used, make sure you did set range correctly
Last message repeated 3 times
While I don't call scale directly, apparently it is implied, because I see in https://trac.ffmpeg.org/wiki/colorspace:
YUV-to-RGB or scaling requires swscale.
The post https://stackoverflow.com/questions/43038294/im-getting-error-deprecated-pixel-format-used-make-sure-you-did-set-range-corr notes this warning can be ignored. However, I'd like to get it right; I've found:
But if you use swscale, you also have to be set the range yourself, or the result will be incorrect.
- Converting yuvj420p to yuv420p - issues with black levels? : ffmpeg with a "solved" example that uses colorspace
... but I have no idea how to specify colorspace for my images
Second problem: not sure if it is related to the first problem, but the output video as result of the above command stops at frame= 421 - and I can see, most of my 249 images are not encoded! Vlc sees some 16 seconds in the output video - way below the 2490 frames, or 99.6 sec, that I expect.
So, what is the correct command line invocation, to get a slide show from image sequence with fade, without the deprecation warnings and with all images encoded?