# Video Converter

**URL:** <https://blenderartists.org/t/video-converter/615886>\
**Category:** Released Add-ons and Extensions\
**Created:** [July 13, 2014, 3:19pm UTC](https://blenderartists.org/t/video-converter/615886 "2014-07-13T15:19:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dindoun](https://blenderartists.org/user_avatar/blenderartists.org/dindoun/32/562418_2.png) [@dindoun](https://blenderartists.org/u/dindoun)\
**Post date:** [July 13, 2014, 3:19pm UTC](https://blenderartists.org/t/video-converter/615886/1 "2014-07-13T15:19:35Z")

</div>

Hi  
using blender ro convert a video demands to go to different panels :  
here’s a panel to have just one converter  
The panel becomes the last panel in Sequence Editor ( N )

```auto

import bpy
from mathutils import Vector

bl_info = {
    "name": "br_VideoReformat",
    "author": "Bruno 'dindoun' Sanchiz ",
    "version": (2, 0),
    "blender": (2, 7, 1),
    "location": "SEQUENCE_EDITOR &gt; UI",
    "description": "transform a video",
    "category": "video",
    'wiki_url': '' \
        '',
    'tracker_url': ''\
        ''}

        
            
class CustomPanel(bpy.types.Panel):
    """A Custom Panel in the Viewport Toolbar"""
    
    bl_label = "transform video"
    bl_space_type = 'SEQUENCE_EDITOR'
    bl_region_type = 'UI'
    
    _frame_rate_args_prev = None
    _preset_class = None
    
    @classmethod
    def poll(cls, context):                
        return 'pas n one'#pas None
    
    def draw_header(self, context):
        layout = self.layout            
    
    def _draw_framerate_label(*args):
        # avoids re-creating text string each draw
        if CustomPanel._frame_rate_args_prev == args:
            return CustomPanel._frame_rate_ret

        fps, fps_base, preset_label = args

        if fps_base == 1.0:
            fps_rate = round(fps)
        else:
            fps_rate = round(fps / fps_base, 2)

        # TODO: Change the following to iterate over existing presets
        custom_framerate = (fps_rate not in {23.98, 24, 25, 29.97, 30, 50, 59.94, 60})

        if custom_framerate is True:
            fps_label_text = "Custom (%r fps)" % fps_rate
            show_framerate = True
        else:
            fps_label_text = "%r fps" % fps_rate
            show_framerate = (preset_label == "Custom")

        CustomPanel._frame_rate_args_prev = args
        CustomPanel._frame_rate_ret = args = (fps_label_text, show_framerate)
        return args

    @staticmethod
    def draw_framerate(sub, rd):
        if CustomPanel._preset_class is None:
            CustomPanel._preset_class = bpy.types.RENDER_MT_framerate_presets

        args = rd.fps, rd.fps_base, CustomPanel._preset_class.bl_label
        fps_label_text, show_framerate = CustomPanel._draw_framerate_label(*args)

        sub.menu("RENDER_MT_framerate_presets", text=fps_label_text)

        if show_framerate:
            sub.prop(rd, "fps")
            sub.prop(rd, "fps_base", text="/")        
        
        
        
        
    def act_strip(self,context):
        try:
            return context.scene.sequence_editor.active_strip
        except AttributeError:
            return None
        
    def draw(self, context):
                
        scene=bpy.context.scene    
        print('scene.sequence_editor.sequences',scene.sequence_editor.sequences.new_movie,dir(scene.sequence_editor.sequences))
        
        layout = self.layout
        rd = scene.render
        ##########################################################################"
        
        
        '''
        
        col = layout.column()
        
        #scene.sequence_editor.sequences.new_movie
        col.prop(scene, "sequence_editor.sequences.new_movie", text="X")
        #tex = context.texture
        #layout.template_image(tex, "image", tex.image_user)
        #bpy.ops.sequencer.movie_strip_add()
        '''

        col = layout.column()
        sub = col.column(align=True)
        sub.label(text="Resolution:")
        sub.prop(rd, "resolution_x", text="X")
        sub.prop(rd, "resolution_y", text="Y")
        sub.prop(rd, "resolution_percentage", text="")

        self.draw_framerate(sub,rd)

        row = layout.row()    
        try:
            strip = self.act_strip(context)
            row.prop(strip, "frame_start")
            row.prop(strip, "filepath", text="")
            print(strip.name,dir(strip))
        except:
            try:
                strip = self.act_strip(context)
                split.prop(strip, "filepath", text="")
            except:
                pass            

        rd = context.scene.render
        image_settings = rd.image_settings
        file_format = image_settings.file_format

        layout.prop(rd, "filepath", text="")

        split = layout.split()

        col = split.column()
        col.active = not rd.is_movie_format
        col.prop(rd, "use_overwrite")
        col.prop(rd, "use_placeholder")

        split.prop(rd, "use_file_extension")

        layout.template_image_settings(image_settings, color_management=False)

        if file_format == 'QUICKTIME':
            quicktime = rd.quicktime

            split = layout.split()
            col = split.column()
            col.prop(quicktime, "codec_type", text="Video Codec")
            col.prop(quicktime, "codec_spatial_quality", text="Quality")

            # Audio
            col.prop(quicktime, "audiocodec_type", text="Audio Codec")
            if quicktime.audiocodec_type != 'No audio':
                split = layout.split()
                if quicktime.audiocodec_type == 'LPCM':
                    split.prop(quicktime, "audio_bitdepth", text="")

                split.prop(quicktime, "audio_samplerate", text="")

                split = layout.split()
                col = split.column()
                if quicktime.audiocodec_type == 'AAC':
                    col.prop(quicktime, "audio_bitrate")

                subsplit = split.split()
                col = subsplit.column()

                if quicktime.audiocodec_type == 'AAC':
                    col.prop(quicktime, "audio_codec_isvbr")

                col = subsplit.column()
                col.prop(quicktime, "audio_resampling_hq")
                
                
                
                
                
                
                
                
        #encoding
        rd = context.scene.render
        if rd.image_settings.file_format in {'FFMPEG', 'XVID', 'H264', 'THEORA'}:
            ffmpeg = rd.ffmpeg

            layout.menu("RENDER_MT_ffmpeg_presets", text="Presets")

            split = layout.split()
            split.prop(rd.ffmpeg, "format")
            if ffmpeg.format in {'AVI', 'QUICKTIME', 'MKV', 'OGG'}:
                split.prop(ffmpeg, "codec")
            elif rd.ffmpeg.format == 'H264':
                split.prop(ffmpeg, "use_lossless_output")
            else:
                split.label()

            row = layout.row()
            row.prop(ffmpeg, "video_bitrate")
            row.prop(ffmpeg, "gopsize")

            split = layout.split()

            col = split.column()
            col.label(text="Rate:")
            col.prop(ffmpeg, "minrate", text="Minimum")
            col.prop(ffmpeg, "maxrate", text="Maximum")
            col.prop(ffmpeg, "buffersize", text="Buffer")

            col = split.column()
            col.prop(ffmpeg, "use_autosplit")
            col.label(text="Mux:")
            col.prop(ffmpeg, "muxrate", text="Rate")
            col.prop(ffmpeg, "packetsize", text="Packet Size")

            layout.separator()

            # Audio:
            if ffmpeg.format != 'MP3':
                layout.prop(ffmpeg, "audio_codec", text="Audio Codec")

            row = layout.row()
            row.prop(ffmpeg, "audio_bitrate")
            row.prop(ffmpeg, "audio_volume", slider=True)
            
            

        row = layout.row()        
        row.operator("render.render", text="Animation", icon='RENDER_ANIMATION').animation = True

        

 
def register():
    print("debut register")
    bpy.utils.register_class(CustomPanel)
    print("fin register")
def unregister():    
    bpy.utils.unregister_class(CustomPanel)
    
if __name__ == " __main__":
    register()
    

```

 ![](https://blenderartists.org/uploads/default/original/4X/e/3/f/e3f2c1a81d2e5945a5ad37bf8e04fe6ec91a45aa.png)

---

<div class="post-metadata">

**Author:** ![Spirou4D](https://blenderartists.org/user_avatar/blenderartists.org/spirou4d/32/14172_2.png) [@Spirou4D](https://blenderartists.org/u/Spirou4D)\
**Post date:** [July 14, 2014, 12:56am UTC](https://blenderartists.org/t/video-converter/615886/2 "2014-07-14T00:56:59Z")

</div>

Thanks Didoun to share this great job! Nice.  
Bye bye  
Spirou4D

---

<div class="post-metadata">

**Author:** ![khidabiz](https://blenderartists.org/letter_avatar_proxy/v4/letter/k/c89c15/32.png) [@khidabiz](https://blenderartists.org/u/khidabiz)\
**Post date:** [July 14, 2014, 6:58am UTC](https://blenderartists.org/t/video-converter/615886/3 "2014-07-14T06:58:35Z")

</div>

tnx dindoun , very helpfull for me ! I had a need for a website I use it [[دانلود فیلتر شکن](http://khida.biz) ] I wish you success

---

<div class="post-metadata">

**Author:** ![3pointEdit](https://blenderartists.org/user_avatar/blenderartists.org/3pointedit/32/2482_2.png) [@3pointEdit](https://blenderartists.org/u/3pointEdit)\
**Post date:** [October 25, 2014, 7:28am UTC](https://blenderartists.org/t/video-converter/615886/4 "2014-10-25T07:28:30Z")

</div>

Will this addon replace the original strip with the converted file?

---

<div class="post-metadata">

**Author:** ![dindoun](https://blenderartists.org/user_avatar/blenderartists.org/dindoun/32/562418_2.png) [@dindoun](https://blenderartists.org/u/dindoun)\
**Post date:** [November 11, 2014, 8:03am UTC](https://blenderartists.org/t/video-converter/615886/5 "2014-11-11T08:03:49Z")

</div>

thanks.

Will this addon replace the original strip with the converted file?  
For now, no.  
I know noone from blender.

I will put the new version in a few.  
dindoun
