From: Maxim Belkin (mbelkin_at_ks.uiuc.edu)
Date: Sat Feb 28 2015 - 14:43:46 CST

Try this:
ffmpeg -r 0.5 -i final.untitled.%05d.jpg -c:v libx264 -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2” -r 30 output.mp4

> On Feb 28, 2015, at 11:07, anu chandra <anu80125_at_gmail.com> wrote:
>
> Dear Maxim,
>
>
> Thanks fro the quick reply. I try to do as you suggested, but encountered with an error as below.
>
> I have files named - final.untitled.00000.jpg, final.untitled.00001.jpg,......, final.untitled.00020.jpg.
>
> I executed the command, ffmpeg -r 0.5 -i final.untitled.%05d.jpg -c:v libx264 -r 30 output.mpg, which unfortunately ended-up with some errors as below.
>
>
>
> ffmpeg version 1.2.6-7:1.2.6-1~trusty1 Copyright (c) 2000-2014 the FFmpeg developers
> built on Apr 26 2014 18:52:58 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
> configuration: --arch=amd64 --disable-stripping --enable-avresample --enable-pthreads --enable-runtime-cpudetect --extra-version='7:1.2.6-1~trusty1' --libdir=/usr/lib/x86_64-linux-gnu --prefix=/usr --enable-bzlib --enable-libdc1394 --enable-libfreetype --enable-frei0r --enable-gnutls --enable-libgsm --enable-libmp3lame --enable-librtmp --enable-libopencv --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-vaapi --enable-vdpau --enable-libvorbis --enable-libvpx --enable-zlib --enable-gpl --enable-postproc --enable-libcdio --enable-x11grab --enable-libx264 --shlibdir=/usr/lib/x86_64-linux-gnu --enable-shared --disable-static
> libavutil 52. 18.100 / 52. 18.100
> libavcodec 54. 92.100 / 54. 92.100
> libavformat 54. 63.104 / 54. 63.104
> libavdevice 53. 5.103 / 53. 5.103
> libavfilter 3. 42.103 / 3. 42.103
> libswscale 2. 2.100 / 2. 2.100
> libswresample 0. 17.102 / 0. 17.102
> libpostproc 52. 2.100 / 52. 2.100
> Input #0, image2, from 'final.untitled.%05d.jpg':
> Duration: 00:00:00.80, start: 0.000000, bitrate: N/A
> Stream #0:0: Video: mjpeg, yuvj444p, 669x716 [SAR 72:72 DAR 669:716], 25 fps, 25 tbr, 25 tbn, 25 tbc
> [libx264 @ 0x1e48780] width not divisible by 2 (669x716)
> Output #0, mpeg, to 'output.mpg':
> Stream #0:0: Video: h264, yuvj420p, 669x716 [SAR 1:1 DAR 669:716], q=-1--1, 90k tbn, 30 tbc
> Stream mapping:
> Stream #0:0 -> #0:0 (mjpeg -> libx264)
> Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
>
>
> Can you please help me to figure out what went wrong here.
>
> Many thanks
> Anu
>
> On Sat, Feb 28, 2015 at 8:53 PM, Maxim Belkin <mbelkin_at_ks.uiuc.edu <mailto:mbelkin_at_ks.uiuc.edu>> wrote:
> You got it right. You have to use console for the second step. And yes, you have to have ffmpeg, so install it if you currently don’t have it.
> ‘03d’ simply expands to a sequence 001, 002, 003, …
> d - means integer
> 3 - minimum number of characters to use for the value
> 0 - if the number uses less than 3 characters - fill them with zeros.
>
> In my example, images are assumed to be named like this:
> imagename001.png imagename002.png imagename003.png ...
> If you don’t have zeros, simply use %d
>
> Maxim
>
>> On Feb 28, 2015, at 07:49, anu chandra <anu80125_at_gmail.com <mailto:anu80125_at_gmail.com>> wrote:
>>
>> Dear john and Maxim,
>>
>> Thanks for the reply.
>>
>> @ Maxim,
>>
>> Can you please explain me a little more about your solution. If I am right, all you suggesting to do is
>>
>> 1. For each of the 20 frames, render the image in png fromat using VMD
>>
>> 2. Then use ffmpeg command as you mentioned to create the movie.
>>
>> Do I have to use VMD console for the second step or I should do in command line from a terminal? Do I have to install ffmpeg in my computer with Ubuntu 14.04 LTS fro this? Can you please brief me the '%03d' in the image naming. Please excuse me for asking you the basics, as I am new to linux.
>>
>>
>> Many thanks in advance
>>
>> Anu
>>
>> On Sat, Feb 28, 2015 at 2:12 AM, Maxim Belkin <mbelkin_at_ks.uiuc.edu <mailto:mbelkin_at_ks.uiuc.edu>> wrote:
>> Alternative solution is to use VMD to render movie frames and then use ffmpeg to render your movie with desired FPS rate.
>>
>> ffmpeg -r 0.5 -i imagename%03d.png -c:v libx264 -r 30 output.mp4
>>
>> Here, every frame will be displayed for 2 seconds (0.5 fps).
>>
>> Maxim
>>
>> > On Feb 27, 2015, at 2:31 PM, John Stone <johns_at_ks.uiuc.edu <mailto:johns_at_ks.uiuc.edu>> wrote:
>> >
>> > Most movie formats display images at 24 or 30 frames per second.
>> > To make a longer movie with VMD, you can either load a larger number
>> > of frames from your simulation trajectory (that's what I'd do) and
>> > use that for your movie, or, if that isn't possible, you can
>> > duplicate each frame 10 times, and than you'll get something that
>> > lasts for about 8 seconds.
>> >
>> > Cheers,
>> > John Stone
>> > vmd_at_ks.uiuc.edu <mailto:vmd_at_ks.uiuc.edu>
>> >
>> > On Sat, Feb 28, 2015 at 01:54:59AM +0530, anu chandra wrote:
>> >> Dear VMD users,
>> >>
>> >> I am trying to make 30second movie with VMD movie making utility. I have a
>> >> short 20 frame trajectory and movie making with 'tajectory' option
>> >> generate only a very short movie ( last for only 6-8 seconds), even though
>> >> I tried changing the 'time duration' options many times. Is there a way in
>> >> VMD where I can make a movie with such a short (20 frame) trajectory?
>> >>
>> >> Many thanks in advance
>> >>
>> >> Anu
>> >
>> > --
>> > NIH Center for Macromolecular Modeling and Bioinformatics
>> > Beckman Institute for Advanced Science and Technology
>> > University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
>> > http://www.ks.uiuc.edu/~johns/ <http://www.ks.uiuc.edu/~johns/> Phone: 217-244-3349 <tel:217-244-3349>
>> > http://www.ks.uiuc.edu/Research/vmd/ <http://www.ks.uiuc.edu/Research/vmd/>
>>
>>
>
>