Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 03-20-2016, 08:59 PM   #1
LQ Newbie
Registered: Mar 2016
Posts: 2

Rep: Reputation: Disabled
Trouble with FFMPEG image stream to video format

I have a folder with about 150 images named IMG_####.JPG with the numbers ranging from 1798 to 1946 and I want to compile them into a high quality video using ffmpeg. I have done this sort of thing before, but I think I'm having issues with my formats. This command, along with many variants, I have tried, but to no avail..

ffmpeg -start_number 1798 -i IMG_%04d.JPG -framerate 12 timelapse.mp4
I ran the command above with a sequence of images that look like this:

The output, when played through Ubuntu's default video player, looks like this:

But the same file played using the VLC player looked like a super stretched out and pixlized version of the video I was trying to produce, but no that I go to take a screen shot, it just shows an empty frame..... super annoying, I don't understand what is changing here...

I'm not sure why there is such a difference, or why the quality is really bad.... Does anyone know some tips on using ffmpeg in this situation to achieve high quality video?
Old 03-20-2016, 09:50 PM   #2
LQ Newbie
Registered: Mar 2016
Posts: 2

Original Poster
Rep: Reputation: Disabled
Here is the output from VLC I was talking about earlier.
Old 03-21-2016, 12:10 AM   #3
Registered: Mar 2015
Distribution: Ubuntu
Posts: 37

Rep: Reputation: Disabled
I'm far (very far) from an expert with "ffmpeg" but I use it from time to time and appreciate the range of functionality if offers. The trouble for me is figure out which of the gazillions options to tweak to get what I want. And I use it do infrequently that I have to struggle and re-learn every time. Well the long time between video projects is one thing. The other is that the software is evolving, and even split into separate "ffmpeg" and "avconf" projects for awhile. Yikes... User confusion launch to new level with that change.

But I can give you general advice and link to a page that has specific info that should help get you started in the right direction. It's all about saving yourself the headache of listing all the options on the commandline by pull in a "preset" file with the appropriate encoding choices.

Where do you get those magical "preset" files. I don't remember where I got them all... Some were in the source package for the "avidemux" tool. Those are for encoding H.264 format only. I somehow found (or created?) presets files to make "webm" format video.

Anyway here are two decent links that might keep you rolling. I just can't remember all the details at the moment.

I'll be reading the replies from people who know "ffmpeg" better than I do to try and (finally?) drill the stuff into my head so I don't have to re-learn from near zero the next time I need to render video from a stream of images.
Old 03-22-2016, 02:38 PM   #4
LQ Newbie
Registered: Mar 2016
Posts: 25

Rep: Reputation: Disabled
Turn A Sequence of Images Into A Movie

The code for ffmpeg in the article doesn't mention this, you can add -q:v num to the ffmpeg code to set the video quality. Eg, -q:v 0 will give best quality. 3 is good, 5 is OK. The higher you go, the lower the video quality.

You can also use -crf num for h264 videos. 0 is lossless, and 28 is the lowest quality. I believe 23 or 25 is the default.

The article also shows you how to do this with mencoder. The article uses a bitrate of 1200 which is pretty good quality. But if you want it higher, just use a higher number.

I suggest running both ffmpeg and mencoder and compare the results.

PS: Read the Summary at the bottom of the article. It will have additional information when using ffmpeg and mencoder with the images.

Last edited by WayneB; 03-22-2016 at 04:03 PM.
1 members found this post helpful.
Old 03-22-2016, 04:44 PM   #5
LQ Newbie
Registered: Mar 2016
Posts: 25

Rep: Reputation: Disabled
Here is another resource for images to video slideshow using ffmpeg.

This one is much better and has more details and fixes like if the first image is skipped or something.

Last edited by WayneB; 03-22-2016 at 04:48 PM.
Old 03-22-2016, 05:08 PM   #6
Senior Member
Registered: Jan 2008
Location: Urbana IL
Distribution: Slackware, Slacko,
Posts: 3,716
Blog Entries: 3

Rep: Reputation: 482Reputation: 482Reputation: 482Reputation: 482Reputation: 482
ffmpeg -r 1/5 -i img%04d.jpeg -c:v libx264 -vf "fps=25,format=yuv420p" out.mp4
put it together with that command.
now your stuff is 25 fps. if you want 12 thats low quality stuff. 25 fps is good. now make the video. after that you can edit it
with kdenlive if you need timelaps slow things down or speed it up.
Old 03-28-2016, 02:51 AM   #7
Senior Member
Registered: Feb 2003
Distribution: debian
Posts: 4,137
Blog Entries: 1

Rep: Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873
by default ffmpeg outputs at 25 fps, you must override this if you do not want that. Also the -aspect value is by default not set, so you must also specify that if you want players to handle the video consistently. I tend to create symlinks starting with 0001 for whatever sequence I want to convert. I find that simpler than trying to remember obscure parameters that might change week to week.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
trouble opening ffmpeg stream in browser r.stiltskin Linux - Software 2 02-24-2016 05:58 PM
Command line to stream audio/video using ffmpeg? Xeratul Linux - General 1 08-05-2014 12:41 PM
FFMPEG : While converting a video how to select second audio stream bloodstreetboy Linux - Software 4 07-16-2012 07:11 AM
ffmpeg mixing audio/video - trying to end vid after video stream completes joejoe99 Linux - Software 2 06-21-2012 11:44 PM
ffmpeg, trying to demux VOB, subtitles show up in video stream Meson Linux - Software 1 01-29-2010 08:41 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:58 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration