Assuming avconv or ffmpeg is available on your system, you can open a pipe
to it:
pipe, process = writesto(`avconv -y -f rawvideo -pix_fmt gray -s 100x100
-r 30 -i - -an -c:v libx264 -pix_fmt yuv420p movie.mp4`)
The options are detailed in the docs; -s is the movie size and -r is the
frame rate.
(If you have ffmpeg, s/avconv/ffmpeg/ and I think this should still work.)
Now every 100x100 block of Uint8s that you write to pipe creates a frame in
the movie (you can obviously change the resolution). Note that the first
dimension of the array is the x dimension and the second is the y
dimension, so you may want to transpose the array before writing it. For
example, to create a movie with 1000 frames of static on the top and black
on the bottom:
for i = 1:1000
write(pipe, [rand(Uint8, 100, 50) zeros(Uint8, 100, 50)])
end
close(pipe)
If you have a 3D array of Uint8s where the dimensions are ordered as x, y,
and time, then you can also write that directly. If you write something
besides Uint8s, you will get garbage. You can tweak the avconv/ffmpeg
encoding settings as necessary and also change the pixel format to add
color if you want.
Hope this helps,
Simon
On Friday, April 11, 2014 8:45:43 AM UTC-4, Sheehan Olver wrote:
>
> Was hoping for something one line on Julia
>
> Sent from my iPhone
>
> On Apr 11, 2014, at 10:18 PM, Arnim Bleier <[email protected]<javascript:>>
> wrote:
>
> Hi,
>
> create pictures for each frame [1:N] ... (lets say pic_n.png)
>
> then
>
> mencoder mf://*.png -mf w=200:h=150:fps=25:type=png -ovc copy -oac copy -o
> out.avi
>
> now you should have a "out.avi"
>
>
> Best
>
> Arnim
>
>
>
> On Friday, April 11, 2014 1:20:18 PM UTC+2, Sheehan Olver wrote:
>>
>> I'm trying to do movies of an evolving solution to a PDE. Let's say that
>> the solution at time steps is stored as columns of an array. Is this
>> possible? Preferably in IJulia, but if that's not possible export from
>> Julia.
>>
>>