[yt-users] how to control the pixel size for projection/slice plot in order to use ffmpeg

Michael Kuhlen mqk at astro.berkeley.edu
Wed Sep 12 16:41:30 PDT 2012


Another fix might be to feed ffmpeg the nearest even pixel count, like so:
"-s 982x886". Or if that doesn't work, you could use ffmpeg's crop filter:
"-vf crop=width:height:x:y".

Cheers,

Mike

On Wed, Sep 12, 2012 at 4:09 PM, Ji Suoqing <jisuoqing at gmail.com> wrote:

> Hi Sam,
>
> Thanks for your detailed response.
>
> Currently I adopt one additional step after getting the plots from YT: I
> use the "crop" command provided by Python Imaging Library to make the pixel
> size of the projection/slice plots to be even numbers. Although this works
> out, I just wonder whether YT could take the even-number pixel size as a
> preference when do projection/slice plots.
>
> Best wishes,
> Suoqing
>
> On Sep 12, 2012, at 5:25 PM, Sam Skillman <samskillman at gmail.com> wrote:
>
> Hi Suoqing,
>
> For a while (and currently in the stable branch), we were using a
> bbox_inches='tight' keyword when saving matplotlib figures to take care of
> fitting all of the labels/axes/etc on the canvas.  As you've noticed
> though, this can lead to different sized images.  Shortly after 2.4 was
> released, we changed this behavior a bit in the "yt" branch so that the
> image size says the same for a given aspect ratio simulation.  I think the
> quickest way to get the behavior you'd like is to cd to your yt-hg
> directory and do:
>
> hg pull;
> hg up -r 3840366c0379
> python setup.py install
>
> Let us know if that helps.
>
> Best,
> Sam
>
> On Wed, Sep 12, 2012 at 11:51 AM, Ji Suoqing <jisuoqing at gmail.com> wrote:
>
>> Hi all,
>>
>> Sometimes I use YT to generate time series projection/slice plots, and
>> use ffmpeg to convert these png file to mp4 movie. However, the problem is
>> ffmpeg only recognizes the png file with the pixel number of length being
>> an even number. If the inputted png file size is not even times even,
>> there's the error:
>>
>> [libx264 @ 0x7fcc3c047000] width not divisible by 2 (983x886)
>> Output #0, mp4, to 'movie.mp4':
>>     Stream #0:0: Video: h264, yuv420p, 983x886, q=-1--1, 90k tbn, 20 tbc
>> Stream mapping:
>>   Stream #0:0 -> #0:0 (png -> libx264)
>> Error while opening encoder for output stream #0:0 - maybe incorrect
>> parameters such as bit_rate, rate, width or height
>>
>> So, is there anyway to control the pixel size of the projection/slice
>> plots to be even? Or, is there a much simpler way to generate a
>> projection/slice movie?
>>
>> Best wishes,
>> Suoqing
>> _______________________________________________
>> yt-users mailing list
>> yt-users at lists.spacepope.org
>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
>
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
>


-- 
*********************************************************************
*                                                                   *
*  Dr. Michael Kuhlen              Theoretical Astrophysics Center  *
*  email: mqk at astro.berkeley.edu   UC Berkeley                      *
*  cell phone: (831) 588-1468      B-116 Hearst Field Annex # 3411  *
*  skype username: mikekuhlen      Berkeley, CA 94720               *
*                                                                   *
*********************************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20120912/e5f0608f/attachment.htm>


More information about the yt-users mailing list