Exemple #1
0
 def on_bt_merge_clicked(self,widget):
     model = self.iconview_dst.get_model()
     iter = model.get_iter_first()
     filename = ""
     size_w = 1000
     size_h = 0
     while ( iter != None ):
         row = model.get_path(iter)
         filename += " "
         filename += model[row][COL_PATH]
         subffix = utils.get_file_subffix(model[row][COL_PATH])
         info = model[row][COL_INFO]
         infos = info.strip('[]').split(',')
         print infos , infos[1]
         w = infos[1].strip(' \'')
         h = infos[2].strip(' \'')
         if int(w) < size_w :
             size_w = int(w)
             size_h = int(h)
         iter = model.iter_next(iter)
     if filename == "":
         return 0
     pic_size = str(size_w)+":"+str(size_h)
     cmd = "mencoder -ovc lavc -oac mp3lame -idx -vf scale=" + pic_size + " " + filename+" -o /tmp/output"+subffix
     print cmd
     self.statusbar.push(0,cmd)
     self.wait_run(cmd)
     self.statusbar.push(0,"done")
Exemple #2
0
    def on_bt_split_clicked(self, widget):
        model = self.iconview_src.get_model()
        selected = self.iconview_src.get_selected_items()
        if len(selected) == 0:
            return
        item = selected[0][0]
        filename = model[item][COL_PATH]

        a_time = self.label_A.get_text()
        b = self.label_B.get_text()
        b_time = utils.string_time_sub(b,a_time)
        #b_time = utils.time_to_string(self.timeline.getB() - self.timeline.getA())
        subffix = utils.get_file_subffix(filename)
        outfile = evhome_dir + "outfile_" + str(self.file_num) + subffix
        if subffix != ".avi":
            outfile = evhome_dir + "outfile_" + str(self.file_num) + ".avi"
            cmd = "mencoder"+" -ss "+a_time+" -endpos "+b_time+"  -ovc lavc -oac pcm "+filename+" -o "+outfile
        else:
            cmd = "mencoder"+" -ss "+a_time+" -endpos "+b_time+"  -ovc copy -oac copy "+filename+" -o "+outfile
        self.file_num += 1
        print cmd
        print self.file_num
        self.statusbar.push(0,cmd)
        self.wait_run(cmd)
        self.statusbar.push(0,"done")
        self.load_dst_file(outfile)
Exemple #3
0
 def on_bt_audio_split_clicked(self, widget):
     a_model = self.iconview_audio.get_model()
     v_model = self.iconview_src.get_model()
     v_selected = self.iconview_src.get_selected_items()
     if len(v_selected) == 0:
         return
     a_selected = self.iconview_audio.get_selected_items()
     if len(a_selected) == 0:
         return
     v_item = v_selected[0][0]
     video_filename = v_model[v_item][COL_PATH]
     a_item = a_selected[0][0]
     audio_filename = a_model[a_item][COL_PATH]
     info = a_model[a_item][COL_INFO]
     infos = info.strip('[]').split(',')
     a_time = infos[1].strip(' \'')
     b = infos[2].strip(' \'')
     b_time = utils.string_time_sub(b, a_time)
     subffix = utils.get_file_subffix(video_filename)
     outfile = evhome_dir+"outfile_"+str(self.file_num) + subffix
     cmd = "mencoder" + " -ss " + a_time + " -endpos " + b_time + "  -ovc copy -oac mp3lame -audiofile " + audio_filename + " " + video_filename + " -o " + outfile
     print cmd
     self.file_num += 1
     self.statusbar.push(0,cmd)
     self.wait_run(cmd)
     self.statusbar.push(0,"done")
     self.load_dst_file(outfile)
Exemple #4
0
    def on_bt_audio_merge_clicked(self, widget):
        a_model = self.iconview_audio.get_model()
        v_model = self.iconview_src.get_model()
        selected = self.iconview_src.get_selected_items()
        if len(selected) == 0:
            return
        item = selected[0][0]
        video_filename = v_model[item][COL_PATH]
        v_info = v_model[item][COL_INFO]
        v_infos = v_info.strip('[]').split(',')
        v_length = v_infos[0].strip('\'')
        v_end = utils.time_to_string(float(v_length))

        audio_filename = ""
        iter = a_model.get_iter_first()
        time_p = "00:00:00"
        cmd = ""
        num = 0
        subffix = utils.get_file_subffix(video_filename)
        cmd_list =[]
        while ( iter != None ):
            row = a_model.get_path(iter)
            audio_filename = a_model[row][COL_PATH]
            info = a_model[row][COL_INFO]
            infos = info.strip('[]').split(',')
            a_time = infos[1].strip(' \'')
            b = infos[2].strip(' \'')
            if b == "0":
                iter = a_model.iter_next(iter)
                continue
            b_time = utils.string_time_sub(b, a_time)
            if a_time == time_p:
                cmd = "mencoder -ss "+ a_time + " -endpos "+ b_time +" -ovc copy -oac mp3lame -audiofile "+audio_filename + " " + video_filename + " -o /tmp/dumpvideo" + str(num) +subffix
                cmd_list.append(cmd)
                num +=1
                time_p = b_time
            else:
                cmd = "mencoder -ss "+ time_p + " -endpos "+ a_time +" -ovc copy -oac copy " + video_filename + " -o /tmp/dumpvideo" + str(num) +subffix
                cmd_list.append(cmd)
                num +=1
                cmd = "mencoder -ss "+ a_time + " -endpos "+ b_time +" -ovc copy -oac mp3lame -audiofile "+audio_filename + " " + video_filename + " -o /tmp/dumpvideo" + str(num) +subffix
                cmd_list.append(cmd)
                num +=1
                time_p = b_time
                
            iter = a_model.iter_next(iter)
        if time_p != v_end:
                cmd = "mencoder -ss "+ time_p + " -endpos "+ v_end +" -ovc copy -oac copy " + video_filename + " -o /tmp/dumpvideo" + str(num) +subffix
                cmd_list.append(cmd)
                num += 1

        filelist=""
        for i in range(0,num):
            filelist += " /tmp/dumpvideo"+str(i)+subffix
        cmd =" mencoder -ovc lavc -oac mp3lame -o /tmp/dumpvideo.avi "+filelist
        cmd_list.append(cmd)
        num += 1

        for i in range(0,num):
            self.statusbar.push(0,cmd)
            print cmd_list[i]
            self.wait_run(cmd_list[i])
        self.statusbar.push(0,"done")
        self.load_src_file("/tmp/dumpvideo.avi")