Paste Code
Paste Blends
Paste Images
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 > 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()
  1. import bpy
  2. from mathutils import Vector
  3.  
  4. bl_info = {
  5.     "name": "br_VideoReformat",
  6.     "author": "Bruno 'dindoun' Sanchiz ",
  7.     "version": (2, 0),
  8.     "blender": (2, 7, 1),
  9.     "location": "SEQUENCE_EDITOR > UI",
  10.     "description": "transform a video",
  11.     "category": "video",
  12.     'wiki_url': '' \
  13.         '',
  14.     'tracker_url': ''\
  15.         ''}
  16.  
  17.        
  18.            
  19. class CustomPanel(bpy.types.Panel):
  20.     """A Custom Panel in the Viewport Toolbar"""
  21.    
  22.     bl_label = "transform video"
  23.     bl_space_type = 'SEQUENCE_EDITOR'
  24.     bl_region_type = 'UI'
  25.    
  26.     _frame_rate_args_prev = None
  27.     _preset_class = None
  28.    
  29.     @classmethod
  30.     def poll(cls, context):                
  31.         return 'pas n one'#pas None
  32.    
  33.     def draw_header(self, context):
  34.         layout = self.layout            
  35.    
  36.     def _draw_framerate_label(*args):
  37.         # avoids re-creating text string each draw
  38.         if CustomPanel._frame_rate_args_prev == args:
  39.             return CustomPanel._frame_rate_ret
  40.  
  41.         fps, fps_base, preset_label = args
  42.  
  43.         if fps_base == 1.0:
  44.             fps_rate = round(fps)
  45.         else:
  46.             fps_rate = round(fps / fps_base, 2)
  47.  
  48.         # TODO: Change the following to iterate over existing presets
  49.         custom_framerate = (fps_rate not in {23.98, 24, 25, 29.97, 30, 50, 59.94, 60})
  50.  
  51.         if custom_framerate is True:
  52.             fps_label_text = "Custom (%r fps)" % fps_rate
  53.             show_framerate = True
  54.         else:
  55.             fps_label_text = "%r fps" % fps_rate
  56.             show_framerate = (preset_label == "Custom")
  57.  
  58.         CustomPanel._frame_rate_args_prev = args
  59.         CustomPanel._frame_rate_ret = args = (fps_label_text, show_framerate)
  60.         return args
  61.  
  62.     @staticmethod
  63.     def draw_framerate(sub, rd):
  64.         if CustomPanel._preset_class is None:
  65.             CustomPanel._preset_class = bpy.types.RENDER_MT_framerate_presets
  66.  
  67.         args = rd.fps, rd.fps_base, CustomPanel._preset_class.bl_label
  68.         fps_label_text, show_framerate = CustomPanel._draw_framerate_label(*args)
  69.  
  70.         sub.menu("RENDER_MT_framerate_presets", text=fps_label_text)
  71.  
  72.         if show_framerate:
  73.             sub.prop(rd, "fps")
  74.             sub.prop(rd, "fps_base", text="/")        
  75.        
  76.        
  77.        
  78.        
  79.     def act_strip(self,context):
  80.         try:
  81.             return context.scene.sequence_editor.active_strip
  82.         except AttributeError:
  83.             return None
  84.        
  85.     def draw(self, context):
  86.                
  87.         scene=bpy.context.scene    
  88.         print('scene.sequence_editor.sequences',scene.sequence_editor.sequences.new_movie,dir(scene.sequence_editor.sequences))
  89.        
  90.         layout = self.layout
  91.         rd = scene.render
  92.         ##########################################################################"
  93.        
  94.        
  95.         '''
  96.        
  97.         col = layout.column()
  98.        
  99.         #scene.sequence_editor.sequences.new_movie
  100.         col.prop(scene, "sequence_editor.sequences.new_movie", text="X")
  101.         #tex = context.texture
  102.         #layout.template_image(tex, "image", tex.image_user)
  103.         #bpy.ops.sequencer.movie_strip_add()
  104.         '''
  105.  
  106.  
  107.         col = layout.column()
  108.         sub = col.column(align=True)
  109.         sub.label(text="Resolution:")
  110.         sub.prop(rd, "resolution_x", text="X")
  111.         sub.prop(rd, "resolution_y", text="Y")
  112.         sub.prop(rd, "resolution_percentage", text="")
  113.  
  114.         self.draw_framerate(sub,rd)
  115.  
  116.  
  117.  
  118.  
  119.  
  120.         row = layout.row()    
  121.         try:
  122.             strip = self.act_strip(context)
  123.             row.prop(strip, "frame_start")
  124.             row.prop(strip, "filepath", text="")
  125.             print(strip.name,dir(strip))
  126.         except:
  127.             try:
  128.                 strip = self.act_strip(context)
  129.                 split.prop(strip, "filepath", text="")
  130.             except:
  131.                 pass            
  132.  
  133.  
  134.  
  135.         rd = context.scene.render
  136.         image_settings = rd.image_settings
  137.         file_format = image_settings.file_format
  138.  
  139.         layout.prop(rd, "filepath", text="")
  140.  
  141.         split = layout.split()
  142.  
  143.         col = split.column()
  144.         col.active = not rd.is_movie_format
  145.         col.prop(rd, "use_overwrite")
  146.         col.prop(rd, "use_placeholder")
  147.  
  148.         split.prop(rd, "use_file_extension")
  149.  
  150.         layout.template_image_settings(image_settings, color_management=False)
  151.  
  152.         if file_format == 'QUICKTIME':
  153.             quicktime = rd.quicktime
  154.  
  155.             split = layout.split()
  156.             col = split.column()
  157.             col.prop(quicktime, "codec_type", text="Video Codec")
  158.             col.prop(quicktime, "codec_spatial_quality", text="Quality")
  159.  
  160.             # Audio
  161.             col.prop(quicktime, "audiocodec_type", text="Audio Codec")
  162.             if quicktime.audiocodec_type != 'No audio':
  163.                 split = layout.split()
  164.                 if quicktime.audiocodec_type == 'LPCM':
  165.                     split.prop(quicktime, "audio_bitdepth", text="")
  166.  
  167.                 split.prop(quicktime, "audio_samplerate", text="")
  168.  
  169.                 split = layout.split()
  170.                 col = split.column()
  171.                 if quicktime.audiocodec_type == 'AAC':
  172.                     col.prop(quicktime, "audio_bitrate")
  173.  
  174.                 subsplit = split.split()
  175.                 col = subsplit.column()
  176.  
  177.                 if quicktime.audiocodec_type == 'AAC':
  178.                     col.prop(quicktime, "audio_codec_isvbr")
  179.  
  180.                 col = subsplit.column()
  181.                 col.prop(quicktime, "audio_resampling_hq")
  182.                
  183.                
  184.                
  185.                
  186.                
  187.                
  188.                
  189.                
  190.         #encoding
  191.         rd = context.scene.render
  192.         if rd.image_settings.file_format in {'FFMPEG', 'XVID', 'H264', 'THEORA'}:
  193.             ffmpeg = rd.ffmpeg
  194.  
  195.             layout.menu("RENDER_MT_ffmpeg_presets", text="Presets")
  196.  
  197.             split = layout.split()
  198.             split.prop(rd.ffmpeg, "format")
  199.             if ffmpeg.format in {'AVI', 'QUICKTIME', 'MKV', 'OGG'}:
  200.                 split.prop(ffmpeg, "codec")
  201.             elif rd.ffmpeg.format == 'H264':
  202.                 split.prop(ffmpeg, "use_lossless_output")
  203.             else:
  204.                 split.label()
  205.  
  206.             row = layout.row()
  207.             row.prop(ffmpeg, "video_bitrate")
  208.             row.prop(ffmpeg, "gopsize")
  209.  
  210.             split = layout.split()
  211.  
  212.             col = split.column()
  213.             col.label(text="Rate:")
  214.             col.prop(ffmpeg, "minrate", text="Minimum")
  215.             col.prop(ffmpeg, "maxrate", text="Maximum")
  216.             col.prop(ffmpeg, "buffersize", text="Buffer")
  217.  
  218.             col = split.column()
  219.             col.prop(ffmpeg, "use_autosplit")
  220.             col.label(text="Mux:")
  221.             col.prop(ffmpeg, "muxrate", text="Rate")
  222.             col.prop(ffmpeg, "packetsize", text="Packet Size")
  223.  
  224.             layout.separator()
  225.  
  226.             # Audio:
  227.             if ffmpeg.format != 'MP3':
  228.                 layout.prop(ffmpeg, "audio_codec", text="Audio Codec")
  229.  
  230.             row = layout.row()
  231.             row.prop(ffmpeg, "audio_bitrate")
  232.             row.prop(ffmpeg, "audio_volume", slider=True)
  233.            
  234.            
  235.  
  236.  
  237.         row = layout.row()        
  238.         row.operator("render.render", text="Animation", icon='RENDER_ANIMATION').animation = True
  239.  
  240.  
  241.        
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249. def register():
  250.     print("debut register")
  251.     bpy.utils.register_class(CustomPanel)
  252.     print("fin register")
  253. def unregister():    
  254.     bpy.utils.unregister_class(CustomPanel)
  255.    
  256. if __name__ == "__main__":
  257.     register()
go to heaven