35

I'm trying to convert group of ".jpg" files acting as individual frames into 1 single mpeg video ".mp4"

Example parameters i used:

frame duration  = 2 secs
frame rate      = 30  fps
encoder         = libx264 (mpeg)
input pattern   = "*.jpg"
output pattern  = video.mp4

Based on ffmpeg wiki instructions at (https://trac.ffmpeg.org/wiki/Create%20a%20video%20slideshow%20from%20images), I issued this command:

ffmpeg -framerate 1/2 -pattern_type glob -i "*.jpg" -c:v libx264 -r 30 -pix_fmt yuv420p video.mp4

But I'm getting this error:

[image2 @ 049ab120] Pattern type 'glob' was selected but globbing is not 
supported by this libavformat build *.jpg: Function not implemented

Which probably means the API pattern matching commands for my build/version have changed. By the way this my windows 32bit ffmpeg download build (ffmpeg-20150702-git-03b2b40-win32-static).

How can I choose a group of files using pattern matching using ffmpeg?

Gunther Struyf
  • 11,083
  • 2
  • 31
  • 56
cyber101
  • 2,672
  • 11
  • 46
  • 81
  • 2
    Why is this down voted? there are many ffmpeg questions on Stackoveflow, ffmpeg is a legitimate video encoding library & API. I have also clearly stated my problem , attempt, and question? – cyber101 Jul 03 '15 at 22:27
  • 3
    By the way I got this kind of working by using ffmpeg input pattern -i `img%1d.jpg` entire command `ffmpeg -y -framerate 1/2 -start_number 1 -i img%1d.jpg -vf scale=720:756 -c:v libx264 -r 30 -pix_fmt yuv420p video.mp4` however this only converts the 1st five frames/JPEG images why is there a limit, How can I convert any amount of JPEGs to a MPEG video? – cyber101 Jul 03 '15 at 22:30
  • 1
    It's `img%01d.jpg` with a zero. It'll only match `img0.jpg` to `img9.jpg` – aergistal Jul 20 '15 at 12:16
  • see also https://superuser.com/questions/666860/clarification-for-ffmpeg-input-option-with-image-files-as-input – Wolfgang Fahl Feb 22 '19 at 08:06

1 Answers1

50

-pattern_type glob requires glob.h.

glob is defined in the POSIX standard and it's not available on Windows by default.

Create/rename your files using sequential file naming image###.jpg then use sequence wildcards like -i image%03d.jpg as input.

aergistal
  • 26,033
  • 5
  • 60
  • 82
  • Please refer to my July 3rd comment above, I solved the original problem , however ffmpeg only encodes 1st 5 files into video , not more, that's the current issue/problem. I need to encode "N" number of frames into a larger sequence. – cyber101 Jul 21 '15 at 00:41
  • Your question refers to glob, please consider updating it or posting a new one. I also commented on your original question. If you need a larger sequence just use `%0n` where `n` is the number of digits. How are your files named? – aergistal Jul 21 '15 at 08:10
  • As you see I already got that issue working on July 03, however it doesnt do more than 5 frames. – cyber101 Jul 22 '15 at 00:02
  • Then update the question and add the naming convention of your files. If you use a sequential index, is it always incremented by 1 without skipping? – aergistal Jul 22 '15 at 08:08
  • Thanks it seems I was naming my files literary img01, img02, img03, etc... Instead of img1, img2, img3 , thanks for the help. Also are you familiar with actual Java API for ffmpeg , ho would I achieve the same result using API rather command line? – cyber101 Jul 27 '15 at 22:07
  • I actually used both Xuggler & JCodec initially which created the same output as ffmpeg , all three outputs play correctly on my PC, Mac, and , Android, however this is meant to play on a embedded device , and the only video that plays correctly on that device is the ffmpeg generated video, dont know why ,thats the reason I need to now compile ffmpeg src into ".ddl" or use "javah" option & access ffmpeg via JNI, I will post this question later today. Thanks a million buddy, but I have a ways to go now, fun , fun fun ... – cyber101 Jul 28 '15 at 21:03
  • `ffmpeg -framerate 15 -pattern_type sequence -start_number 00001 -i C:\Users\u\Videos\LRT_%05d.jpg -s:v 1920x1080 -c:v libx264 -crf 17 -pix_fmt yuv420p C:\Users\u\Videos\my-timelapse_1.mp4` – y.selivonchyk Dec 13 '20 at 07:06