2
$\begingroup$

Here is the context : I call blender by the command line like so : blender -b -P myscript.py

In the python script i am doing something simple, i add a movie strip with no sound and then print orignal size of the video:

bpy.ops.sequencer.movie_strip_add({'area': area},filepath='/tmp/file.mp4',frame_start=1, channel=1)

active_strip = bpy.context.scene.sequence_editor.active_strip

print(active_strip.elements[0].orig_height)

print(active_strip.elements[0].orig_width)

The problem is that i always get 0 for both height and width which is not the original dimension of the video.

When i execute this inside blender python console i get the right original dimensions.

Any ideas why it does'nt work by the command line?

Thanks

$\endgroup$

1 Answer 1

0
$\begingroup$

I've found that you have to show strip in the VSE viewport to get dimesions to work. Since there's no viewports in background mode, Blender can't update information about a strip you added. So you're getting zeros.

$\endgroup$
1
  • $\begingroup$ Pity we can't get it from blender in the background. Thanks. Finally I just used moviepy to gett hese data and then send it to blender through the command line. $\endgroup$
    – johnconnor
    Jul 1, 2017 at 21:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .