# How to set Frame Range automatically to video length

How can I set a End Frame of blender movie clip editor to match the end time of the video (without trying to search the End Frame of video)? Currently when I'm importing the video, the End Frame is set to 250 instead of ~600 which my video is currently having.

• Quick manual solution: Press PageUp after inserting the clip to jump to its end with your playhead, then hover over the timeline and press E to set the end frame – Samoth Jul 5 '16 at 6:52
• nothing happen when i do so...i'm i doing it wrong? – aji Jul 5 '16 at 8:12
• The PageUp / PageDown only works while hovering your mouse over the VSE view. It jumps with the green playhead between each cut (start/end of strips). The hotkey E (while hovering over the timeline view) sets the Scene.frame_end (the "End: 250" box) to your current playhead position (Scene.frame_current). It works fine for me (but only with recent versions of Blender like 2.76/2.77a, this behaviour has been added not too long ago). – Samoth Jul 5 '16 at 8:18

### Your problem - from a VSE point of view:

You want your End Frame Range to be set to your newly imported Footages length.

### The solution:

While still hovering over the VSE view press PageUp.

Hover your mouse over your timeline and press E to match your End Frame with your Current frame. (Blenders Hotkeys are context sensitive)

Note:
Make sure, the function Use Preview Range is unchecked if you want your Scene Frame Range to be set accordingly for your final Render.

### Further explanation regarding your situation:

You want to achieve this in the MCE directly. Which is possible via some Python code. But for a quick manual workaround just import your MCE Clip into a VSE via Add (Shift+A) - Clip - <Movie Clip Name> as it will produce the result you want in the MCE as well. The Frame Range used is the current Scene ones which is applied to both the VSE and the MCE. You could delete your VSE Strip of the MCE clip afterwards if you don't want it to be rendered out.

• This has been not working any more by default in the earlier 2.80 versions, but just now the devs reintroduced these hotkeys. :-) – Samoth Nov 6 '19 at 22:31

When your MCE is open, you could just use this line of Python to achieve your goal:

bpy.context.scene.frame_end = [area for area in bpy.data.screens.get(bpy.context.screen.name).areas.values() if area.type == 'CLIP_EDITOR'][0].spaces[0].clip.frame_duration

This basically just sets your End Frame to the Length of your Video Clip that is currently loaded into your MCE. It does so by getting the current active Screen, searching for the Area which is the MCE and uses this only one left from the list of all visible areas and from within it takes the selected/active clip and uses its length.

Paste it into a Python Console View, hit Enter et voilà.

And I already described how to execute such a piece of code via hotkey.