Example #1
0
    def get_paths(self, asset_id, target_mimetype, **options):
        """"""
        transcoder = self._get_transcoder(asset_id.mimetype, target_mimetype)
        convert_map_entry = transcoder.plugin_object.convert_map[asset_id.mimetype][target_mimetype.mimetype]

        path_templates = []
        single_options = dict([(option.name, option) for option in convert_map_entry if not option.is_array])
        single_options = dict([(option, value) for option, value in options.items() if option in single_options])
        array_options = dict([(option.name, option) for option in convert_map_entry if option.is_array])
        array_options = dict([(option, value) for option, value in options.items() if option in array_options])

        from damn_at.options import expand_path_template
        path_template = expand_path_template(target_mimetype.template, target_mimetype.mimetype, asset_id, **single_options)

        #TODO: does not work for multiple arrays.
        if len(array_options):
            for key, values in array_options.items():
                from string import Template
                for value in values:
                    t = Template(path_template)
                    file_path = t.safe_substitute(**{key: value})
                    path_templates.append(file_path)
        else:
            path_templates.append(path_template)

        return path_templates
    def transcode(self, dest_path, file_descr, asset_id, target_mimetype,
                  **options):
        file_path = expand_path_template(target_mimetype.template,
                                         target_mimetype.mimetype, asset_id,
                                         **options)

        try:
            im = Image.open(file_descr.file.filename)
        except IOError:
            print(("cannot open", file_descr.file.fileName))
            return False

        if options['size'] != [-1, -1]:
            im.thumbnail(options['size'])

        if im.mode == 'P':
            im = im.convert('RGB')

        full_path = os.path.join(dest_path, file_path)
        if not os.path.exists(os.path.dirname(full_path)):
            os.makedirs(os.path.dirname(full_path))

        im.save(full_path)

        return [file_path]
Example #3
0
 def transcode(self, dest_path, file_descr, asset_id, target_mimetype, **options):
     path_template = expand_path_template(target_mimetype.template, target_mimetype.mimetype, asset_id, **options)
     abs_file_path = os.path.join(dest_path, path_template)
     abs_file_path_txt = abs_file_path+'.txt'
                 
     arguments = ['--', asset_id.mimetype, asset_id.subname, abs_file_path_txt]
     
     
     logger.debug(abs_file_path)
         
     stdoutdata, stderrdata, returncode = run_blender(file_descr.file.filename, script_path(__file__), arguments)
     
     logger.debug(stdoutdata)
     logger.debug(stderrdata)
     logger.debug(returncode)
     #print(returncode) #Todo: check return code
     
     arguments = ['convert', '-pointsize', '26', '-resize', str(options['size'][0]), abs_file_path_txt+'[0]', abs_file_path]
     print arguments
     pro = subprocess.Popen(arguments, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
     stdoutdata, stderrdata = pro.communicate()
     logger.debug(stdoutdata)
     logger.debug(stderrdata)
     logger.debug(pro.returncode)
     
     
     return [path_template]
    def transcode(self, dest_path, file_descr, asset_id, target_mimetype,
                  **options):

        path_template = expand_path_template(target_mimetype.template,
                                             target_mimetype.mimetype,
                                             asset_id, **options)
        path_template = os.path.join(dest_path, path_template)

        arguments = [
            '--', file_descr.file.filename, asset_id.subname, path_template
        ]
        arguments.append('--format=PNG')  #TODO
        arguments.append('--width=' + str(options['size'][0]))
        arguments.append('--height=' + str(options['size'][1]))

        stdoutdata, stderrdata, returncode = run_blender(
            os.path.join(os.path.dirname(__file__),
                         'BlenderMaterialPreviewScenes.blend'),
            script_path(__file__), arguments)

        logger.debug(stdoutdata)
        logger.debug(stderrdata)
        logger.debug(returncode)
        #print(returncode) #Todo: check return code

        return path_template
    def transcode(self, dest_path, file_descr, asset_id, target_mimetype, **options):

        file_path = expand_path_template(target_mimetype.template, target_mimetype.mimetype, asset_id, **options)
        full_path = os.path.join(dest_path, file_path)

        arguments = ['--', asset_id.subname, full_path]

        stdoutdata, stderrdata, returncode = run_blender(file_descr.file.filename, script_path(__file__), arguments)

        #print(stdoutdata)
        #print(stderrdata)
        #print(returncode) #Todo: check return code

        try:
          im = Image.open(full_path)
        except IOError:
          print("Cannot open: %s" % full_path)
          return False

        if tuple(options['size']) != (-1,-1):
          im.thumbnail(options['size'])

        if im.mode == 'P':
          im = im.convert('RGB')

        im.save(full_path)

        return [file_path]
Example #6
0
    def transcode(self, dest_path, file_descr, asset_id, target_mimetype,
                  **options):

        file_path = expand_path_template(target_mimetype.template,
                                         target_mimetype.mimetype, asset_id,
                                         **options)

        audio_mimetype = mimetypes.guess_type(file_descr.file.filename)[0]
        try:
            tmp = tempfile.NamedTemporaryFile()
            pro = subprocess.Popen([
                "sox", file_descr.file.filename, "-t", "wav", "-r",
                str(options['samplerate']), tmp.name
            ],
                                   stdout=subprocess.PIPE,
                                   stderr=subprocess.PIPE)
            out, err = pro.communicate()
            if pro.returncode != 0:
                print(
                    "Sox failed %s with error code %d!" %
                    (file_decrs.file.filename, pro.returncode), out, err)
                return False
            else:
                toopen = tmp.name
        except OSError:
            print("Sox failed %s!" % (file_descr.file.filename), out, err)
            return False

        wavedata = WaveData()
        wavedata.extractData(toopen, options['precision'])
        channels = wavedata.getData()

        if wavedata.nchannels == options['channels']:
            if options['channels'] == 1:
                transcoded = json.dumps({"mono": channels[0]})
            elif options['channels'] == 2:
                transcoded = json.dumps({
                    "left": channels[0],
                    "right": channels[1]
                })

        else:
            if options['channels'] == 1:
                transcoded = json.dumps({"mono": channels[0]})
            else:
                transcoded = json.dumps({
                    "left": channels[0],
                    "right": channels[0]
                })

        full_path = os.path.join(dest_path, file_path)
        if not os.path.exists(os.path.dirname(full_path)):
            os.makedirs(os.path.dirname(full_path))

        output_file = open(full_path, 'w')
        output_file.write(transcoded)
        output_file.close()

        return [file_path]
 def transcode(self, dest_path, file_descr, asset_id, target_mimetype, **options):
     path_template = expand_path_template(target_mimetype.template, target_mimetype.mimetype, asset_id, **options)
     abs_file_path = os.path.join(dest_path, path_template)
     template = Template(path_template+'__${angles}')
     
     angles = [0.0, 0.1, 0.5]
     
     width = options['size'][0] * options['footage']
     height = options['size'][1] * (options['frames']/options['footage'])
       
     angles = []
     file_paths = []
     for angle in range(0, 628, 628/12):
         angle = angle/100.0
         file_path = template.safe_substitute(angles=angle)
         file_paths.append(file_path)
         angles.append(angle)
         
     if asset_id.mimetype == 'application/x-blender.mesh':
         datatype = 'mesh' 
     elif asset_id.mimetype == 'application/x-blender.group':
         datatype = 'group' 
     else:
         datatype = 'object' 
         
     arguments = ['--', datatype, asset_id.subname, os.path.join(dest_path, template.safe_substitute())]
     arguments.extend(map(str, angles))
     arguments.append('--format=PNG')#TODO
     arguments.append('--camera_type=PERSPECTIVE')
     arguments.append('--width='+str(options['size'][0]))
     arguments.append('--height='+str(options['size'][1]))
     
     script = os.path.join(os.path.dirname(__file__), '../render/b-script-transcoderblenderrender.py')
     
     logger.debug(abs_file_path)
         
     stdoutdata, stderrdata, returncode = run_blender(file_descr.file.filename, script, arguments)
     
     logger.debug(stdoutdata)
     logger.debug(stderrdata)
     logger.debug(returncode)
     #print(returncode) #Todo: check return code
     
     sprite = Image.new('RGB', (width, height))
     for i, file_path in enumerate(file_paths):
         path = os.path.join(dest_path, file_path)
         tile = Image.open(path)
         x = (i%options['footage'])*options['size'][0]
         y = (i/options['footage'])*options['size'][1]
         sprite.paste(tile, (x,y))
     
     #sprite.show()    
     sprite.save(abs_file_path)
     
     return [path_template]
Example #8
0
    def transcode(self, dest_path, file_descr, asset_id, target_mimetype,
                  **options):
        angles = options['angles']
        del options['angles']

        path_template = expand_path_template(target_mimetype.template,
                                             target_mimetype.mimetype,
                                             asset_id, **options)
        path_template = os.path.join(dest_path, path_template)

        file_paths = []
        for angle in angles:
            opts = dict(options)
            opts['angles'] = angle
            file_path = expand_path_template(target_mimetype.template,
                                             target_mimetype.mimetype,
                                             asset_id, **opts)
            file_paths.append(file_path)

        if asset_id.mimetype == 'application/x-blender.mesh':
            datatype = 'mesh'
        elif asset_id.mimetype == 'application/x-blender.group':
            datatype = 'group'
        else:
            datatype = 'object'

        arguments = ['--', datatype, asset_id.subname, path_template]
        arguments.extend(list(map(str, angles)))
        arguments.append('--format=PNG')  # TODO
        arguments.append('--camera_type=PERSPECTIVE')
        arguments.append('--width=' + str(options['size'][0]))
        arguments.append('--height=' + str(options['size'][1]))

        stdoutdata, stderrdata, returncode = run_blender(
            file_descr.file.filename, script_path(__file__), arguments)

        logger.debug(stdoutdata)
        logger.debug(stderrdata)
        logger.debug(returncode)
        # print(returncode) #Todo: check return code

        return file_paths
Example #9
0
    def transcode(self, dest_path, file_descr, asset_id, target_mimetype,
                  **options):

        file_path = expand_path_template(target_mimetype.template,
                                         target_mimetype.mimetype, asset_id,
                                         **options)

        audio_mimetype = mimetypes.guess_type(file_descr.file.filename)[0]
        try:
            tmp = tempfile.NamedTemporaryFile()
            pro = subprocess.Popen([
                "sox", file_descr.file.filename, "-t", "wav", "-r",
                str(options['samplerate']), tmp.name
            ],
                                   stdout=subprocess.PIPE,
                                   stderr=subprocess.PIPE)
            out, err = pro.communicate()
            if pro.returncode != 0:
                print(
                    "Sox failed %s with error code %d!" %
                    (file_decrs.file.filename, pro.returncode), out, err)
                return False
            else:
                toopen = tmp.name
        except OSError:
            print("Sox failed %s!" % (file_descr.file.filename), out, err)
            return False

        wavedata = WaveData()
        wavedata.extractData(toopen, 2)
        channels = wavedata.getData()
        gcolor = options['color']

        plt.figure(1, figsize=options['size'])
        if wavedata.nchannels == 2:
            plt.subplot(211)
            plt.plot(channels[0], color=gcolor)
            plt.axis('off')
            plt.subplot(212)
            plt.plot(channels[1], color=gcolor)
        else:
            plt.plot(channels[0])

        plt.axis('off')

        full_path = os.path.join(dest_path, file_path)
        if not os.path.exists(os.path.dirname(full_path)):
            os.makedirs(os.path.dirname(full_path))

        plt.savefig(full_path, dpi=options['dpi'])

        return [file_path]
 def transcode(self, dest_path, file_descr, asset_id, target_mimetype, **options):
     angles = options['angles']
     del options['angles']
     
     path_template = expand_path_template(target_mimetype.template, target_mimetype.mimetype, asset_id, **options)
     path_template = os.path.join(dest_path, path_template)
     
     file_paths = []
     for angle in angles:
         opts = dict(options)
         opts['angles'] = angle
         file_path = expand_path_template(target_mimetype.template, target_mimetype.mimetype, asset_id, **opts)
         file_paths.append(file_path)
         
     if asset_id.mimetype == 'application/x-blender.mesh':
         datatype = 'mesh' 
     elif asset_id.mimetype == 'application/x-blender.group':
         datatype = 'group' 
     else:
         datatype = 'object' 
         
     arguments = ['--', datatype, asset_id.subname, path_template]
     arguments.extend(map(str, angles))
     arguments.append('--format=PNG')#TODO
     arguments.append('--camera_type=PERSPECTIVE')
     arguments.append('--width='+str(options['size'][0]))
     arguments.append('--height='+str(options['size'][1]))
     
     
         
     stdoutdata, stderrdata, returncode = run_blender(file_descr.file.filename, script_path(__file__), arguments)
     
     logger.debug(stdoutdata)
     logger.debug(stderrdata)
     logger.debug(returncode)
     #print(returncode) #Todo: check return code
     
     return file_paths
 def transcode(self, dest_path, file_descr, asset_id, target_mimetype, **options):
     
     path_template = expand_path_template(target_mimetype.template, target_mimetype.mimetype, asset_id, **options)
     path_template = os.path.join(dest_path, path_template)
         
     arguments = ['--', asset_id.subname, path_template]
         
     stdoutdata, stderrdata, returncode = run_blender(file_descr.file.filename, script_path(__file__), arguments)
     
     logger.debug(stdoutdata)
     logger.debug(stderrdata)
     logger.debug(returncode)
     #print(returncode) #Todo: check return code
     
     return path_template
    def transcode(self, dest_path, file_descr, asset_id, target_mimetype,
            **options):

        file_path = expand_path_template(target_mimetype.template,
                target_mimetype.mimetype, asset_id, **options)
        
        audio_mimetype = mimetypes.guess_type(file_descr.file.filename)[0]
        try:
            tmp = tempfile.NamedTemporaryFile()
            pro = subprocess.Popen(["sox", file_descr.file.filename, "-t", "wav", "-r", str(options['samplerate']), tmp.name], 
                stdout=subprocess.PIPE, stderr=subprocess.PIPE)
            out, err = pro.communicate()
            if pro.returncode != 0:
                print("Sox failed %s with error code %d!" %(file_decrs.file.filename, pro.returncode), 
                        out, err)
                return False
            else:
                toopen = tmp.name
        except OSError:
            print("Sox failed %s!" %(file_descr.file.filename), out, err)
            return False

        wavedata = WaveData()
        wavedata.extractData(toopen, options['precision'])
        channels = wavedata.getData()

        if wavedata.nchannels == options['channels']:
            if options['channels'] == 1:
                transcoded = json.dumps({"mono": channels[0]})
            elif options['channels'] ==2:
                transcoded = json.dumps({"left": channels[0], "right": channels[1]})

        else:
            if options['channels'] == 1:
                transcoded = json.dumps({"mono": channels[0]})
            else :
                transcoded = json.dumps({"left": channels[0], "right": channels[0]})
        
        full_path = os.path.join(dest_path, file_path)
        if not os.path.exists(os.path.dirname(full_path)):
            os.makedirs(os.path.dirname(full_path))

        output_file = open(full_path, 'w')
        output_file.write(transcoded)
        output_file.close()

        return [file_path]
    def transcode(self, dest_path, file_descr, asset_id, target_mimetype,
            **options):

        file_path = expand_path_template(target_mimetype.template,
                target_mimetype.mimetype, asset_id, **options)
        
        audio_mimetype = mimetypes.guess_type(file_descr.file.filename)[0]
        try:
            tmp = tempfile.NamedTemporaryFile()
            pro = subprocess.Popen(["sox", file_descr.file.filename, "-t", "wav", "-r", str(options['samplerate']),  tmp.name], 
                stdout=subprocess.PIPE, stderr=subprocess.PIPE)
            out, err = pro.communicate()
            if pro.returncode != 0:
                print("Sox failed %s with error code %d!" %(file_decrs.file.filename, pro.returncode), 
                        out, err)
                return False
            else:
                toopen = tmp.name
        except OSError:
            print("Sox failed %s!" %(file_descr.file.filename), out, err)
            return False

        wavedata = WaveData()
        wavedata.extractData(toopen, 2)
        channels = wavedata.getData()
        gcolor = options['color']

        plt.figure(1, figsize = options['size'])
        if wavedata.nchannels == 2:
            plt.subplot(211)
            plt.plot(channels[0], color = gcolor)
            plt.axis('off')
            plt.subplot(212)
            plt.plot(channels[1], color = gcolor)
        else:
            plt.plot(channels[0])
        
        plt.axis('off')
        
        full_path = os.path.join(dest_path, file_path)
        if not os.path.exists(os.path.dirname(full_path)):
            os.makedirs(os.path.dirname(full_path))

        plt.savefig(full_path, dpi = options['dpi'])

        return [file_path]
    def transcode(self, dest_path, file_descr, asset_id, target_mimetype,
                  **options):

        file_path = expand_path_template(target_mimetype.template,
                                         target_mimetype.mimetype, asset_id,
                                         **options)

        time = file_descr.assets[0].metadata['duration'].string_value.split(
            ':')
        time = eval(time[0]) * 3600 + eval(time[1]) * 60 + eval(time[2])
        if time < options['second']:
            print("Not in range of video", file_descr.file.filename)
            return False

        if options['second'] == -1:
            second = time / 2
        else:
            second = options['second']
        try:
            tmp = tempfile.NamedTemporaryFile(suffix='.jpeg')
            pro = subprocess.Popen([
                'ffmpeg', '-ss',
                str(second), '-i', file_descr.file.filename, '-t', '1', '-r',
                '1', tmp.name, '-y'
            ])
            out, err = pro.communicate()
            if pro.returncode != 0:
                print(
                    'ffmpeg failed %s with error code %d' %
                    (file_descr.file.filename, pro.returncode), err)
                return False
        except OSError:
            print("Cannot open video", file_descr.file.filename)
            return False

        image = Image.open(tmp.name)

        full_path = os.path.join(dest_path, file_path)
        if not os.path.exists(os.path.dirname(full_path)):
            os.makedirs(os.path.dirname(full_path))

        if options['size'] != [-1, -1]:
            image.thumbnail(options['size'])
        image.save(full_path)

        return [file_path]
 def transcode(self, dest_path, file_descr, asset_id, target_mimetype, **options):
     
     path_template = expand_path_template(target_mimetype.template, target_mimetype.mimetype, asset_id, **options)
     path_template = os.path.join(dest_path, path_template)
         
     arguments = ['--', file_descr.file.filename, asset_id.subname, path_template]
     arguments.append('--format=PNG')#TODO
     arguments.append('--width='+str(options['size'][0]))
     arguments.append('--height='+str(options['size'][1]))
         
     stdoutdata, stderrdata, returncode = run_blender(os.path.join(os.path.dirname(__file__), 'BlenderMaterialPreviewScenes.blend'), script_path(__file__), arguments)
     
     logger.debug(stdoutdata)
     logger.debug(stderrdata)
     logger.debug(returncode)
     #print(returncode) #Todo: check return code
     
     return path_template
    def transcode(self, dest_path, file_descr, asset_id, target_mimetype, **options):

        path_template = expand_path_template(target_mimetype.template, target_mimetype.mimetype, asset_id, **options)
        path_template = os.path.join(dest_path, path_template)

        arguments = ["--", asset_id.subname, path_template]
        arguments.append("--format=PNG")  # TODO
        arguments.append("--width=" + str(options["size"][0]))
        arguments.append("--height=" + str(options["size"][1]))

        stdoutdata, stderrdata, returncode = run_blender(file_descr.file.filename, script_path(__file__), arguments)

        logger.debug(stdoutdata)
        logger.debug(stderrdata)
        logger.debug(returncode)
        # print(returncode) #Todo: check return code

        return path_template
Example #17
0
    def transcode(self, dest_path, file_descr,
            asset_id, target_mimetype, **options):

        file_path = expand_path_template(target_mimetype.template,
                target_mimetype.mimetype, asset_id, **options)

        time = file_descr.assets[0].metadata['duration'].string_value.split(':')
        time = eval(time[0])*3600 + eval(time[1])*60 + eval(time[2])
        if time < options['second']:
            print "Not in range of video", file_descr.file.filename
            return False

        if options['second']==-1:
            second = time/2
        else:
            second = options['second']
        try:
            tmp = tempfile.NamedTemporaryFile(suffix = '.jpeg')
            pro = subprocess.Popen(['ffmpeg', '-ss', str(second), '-i',
                file_descr.file.filename, '-t', '1', '-r', '1', tmp.name, '-y' ])
            out, err = pro.communicate()
            if pro.returncode != 0:
                print('ffmpeg failed %s with error code %d' 
                        %(file_descr.file.filename, pro.returncode), err)
                return False
        except OSError:
            print "Cannot open video", file_descr.file.filename
            return False

        image = Image.open(tmp.name)
        
        full_path = os.path.join(dest_path, file_path)
        if not os.path.exists(os.path.dirname(full_path)):
            os.makedirs(os.path.dirname(full_path))

        if options['size'] != [-1, -1]:
            image.thumbnail(options['size'])
        image.save(full_path)

        return [file_path]
    def transcode(self, dest_path, file_descr, asset_id, target_mimetype, **options):
        file_path = expand_path_template(target_mimetype.template, target_mimetype.mimetype, asset_id, **options)

        try:
          im = Image.open(file_descr.file.filename)
        except IOError:
          print("cannot open", file_descr.file.fileName)
          return False

        if options['size'] != [-1,-1]:
          im.thumbnail(options['size'])

        if im.mode == 'P':
          im = im.convert('RGB')

        full_path = os.path.join(dest_path, file_path)
        if not os.path.exists(os.path.dirname(full_path)):
            os.makedirs(os.path.dirname(full_path))

        im.save(full_path)

        return [file_path]
Example #19
0
    def get_paths(self, asset_id, target_mimetype, **options):
        """"""
        transcoder = self._get_transcoder(asset_id.mimetype, target_mimetype)
        convert_map_entry = transcoder.plugin_object.convert_map[
            asset_id.mimetype][target_mimetype.mimetype]

        path_templates = []
        single_options = dict([(option.name, option)
                               for option in convert_map_entry
                               if not option.is_array])
        single_options = dict([(option, value)
                               for option, value in options.items()
                               if option in single_options])
        array_options = dict([(option.name, option)
                              for option in convert_map_entry
                              if option.is_array])
        array_options = dict([(option, value)
                              for option, value in options.items()
                              if option in array_options])

        from damn_at.options import expand_path_template
        path_template = expand_path_template(target_mimetype.template,
                                             target_mimetype.mimetype,
                                             asset_id, **single_options)

        #TODO: does not work for multiple arrays.
        if len(array_options):
            for key, values in array_options.items():
                from string import Template
                for value in values:
                    t = Template(path_template)
                    file_path = t.safe_substitute(**{key: value})
                    path_templates.append(file_path)
        else:
            path_templates.append(path_template)

        return path_templates
    def transcode(self, dest_path, file_descr, asset_id, target_mimetype,
                  **options):
        path_template = expand_path_template(target_mimetype.template,
                                             target_mimetype.mimetype,
                                             asset_id, **options)
        abs_file_path = os.path.join(dest_path, path_template)
        abs_file_path_txt = abs_file_path + '.txt'

        arguments = [
            '--', asset_id.mimetype, asset_id.subname, abs_file_path_txt
        ]

        logger.debug(abs_file_path)

        stdoutdata, stderrdata, returncode = run_blender(
            file_descr.file.filename, script_path(__file__), arguments)

        logger.debug(stdoutdata)
        logger.debug(stderrdata)
        logger.debug(returncode)
        #print(returncode) #Todo: check return code

        arguments = [
            'convert', '-pointsize', '26', '-resize',
            str(options['size'][0]), abs_file_path_txt + '[0]', abs_file_path
        ]
        # print arguments
        pro = subprocess.Popen(arguments,
                               stdout=subprocess.PIPE,
                               stderr=subprocess.PIPE)
        stdoutdata, stderrdata = pro.communicate()
        logger.debug(stdoutdata)
        logger.debug(stderrdata)
        logger.debug(pro.returncode)

        return [path_template]
    def transcode(self, dest_path, file_descr, asset_id, target_mimetype,
                  **options):
        path_template = expand_path_template(target_mimetype.template,
                                             target_mimetype.mimetype,
                                             asset_id, **options)
        abs_file_path = os.path.join(dest_path, path_template)
        template = Template(path_template + '__${angles}')

        angles = [0.0, 0.1, 0.5]

        width = options['size'][0] * options['footage']
        height = options['size'][1] * (options['frames'] // options['footage'])

        angles = []
        file_paths = []
        for angle in range(0, 628, 628 // 12):
            angle = angle // 100.0
            file_path = template.safe_substitute(angles=angle)
            file_paths.append(file_path)
            angles.append(angle)

        if asset_id.mimetype == 'application/x-blender.mesh':
            datatype = 'mesh'
        elif asset_id.mimetype == 'application/x-blender.group':
            datatype = 'group'
        else:
            datatype = 'object'

        arguments = [
            '--', datatype, asset_id.subname,
            os.path.join(dest_path, template.safe_substitute())
        ]
        arguments.extend(list(map(str, angles)))
        arguments.append('--format=PNG')  # TODO
        arguments.append('--camera_type=PERSPECTIVE')
        arguments.append('--width=' + str(options['size'][0]))
        arguments.append('--height=' + str(options['size'][1]))

        script = os.path.join(os.path.dirname(__file__),
                              '../render/b-script-transcoderblenderrender.py')

        logger.debug(abs_file_path)

        stdoutdata, stderrdata, returncode = run_blender(
            file_descr.file.filename, script, arguments)

        logger.debug(stdoutdata)
        logger.debug(stderrdata)
        logger.debug(returncode)
        # print(returncode) # Todo: check return code

        sprite = Image.new('RGB', (width, height))
        for i, file_path in enumerate(file_paths):
            path = os.path.join(dest_path, file_path)
            tile = Image.open(path)
            x = (i % options['footage']) * options['size'][0]
            y = (i // options['footage']) * options['size'][1]
            sprite.paste(tile, (x, y))

        # sprite.show()
        sprite.save(abs_file_path)

        return [path_template]