def _show_video_thumbnail(self, path, widget): try: video = VideoFile(path) video.seek_to(20) timestamp, frame = video.get_next_frame() image = QtGui.QImage(frame.data, frame.width, frame.height, QtGui.QImage.Format_RGB888).scaledToWidth(widget.width()) pixmap = QtGui.QPixmap.fromImage(image) widget.setPixmap(pixmap) except Exception as e: logger.error(e) return
def _check_video_samplerate(self): video1 = VideoFile(unicode(self.cmbRenderedVideo.itemText(self.cmbRenderedVideo.currentIndex()))) video2 = VideoFile(unicode(self.cmbSlideVideo.itemText(self.cmbSlideVideo.currentIndex()))) if video1.get_info().audio_samplerate != video2.get_info().audio_samplerate: msgbox = QMessageBox(QMessageBox.Critical, "Bad videos", "Audio samplerate must be the same for both videos!") msgbox.setDetailedText("Sample rate of audio tracks in both video has to be the same, e.g. 48000Hz for both.") msgbox.exec_() return False return True
from picture import Picture, Face from video import VideoFile import sys surat = Face(sys.argv[1]) vid = VideoFile(sys.argv[2]) numpics = 0 success = 0 for i in range(int(vid.info.frame_count)): state, pic = vid.export_image() pic.find_faces() numpics += len(pic.faces) if len(pic.faces) > 0: if True in surat.face_match(pic): success += 1 print( "In frame %d, found %d faces total %d successful %d ratio %f" % (i, len(pic.faces), numpics, success, (success / (numpics * 1.0) * 100)))
from video import VideoFile v = VideoFile("test.mp4") v.add_image_directory("slides") v.save()
import os import glob from video import VideoFile result = [] for x in os.walk('/mnt/d/Dizi'): for y in glob.glob(os.path.join(x[0], '*.mkv')): result.append(y) for vf in result: in_vid = VideoFile(vf) if in_vid.format_name != '.mp4' or \ in_vid.height > 480 or \ in_vid.width > 840 or \ in_vid.bit_rate > 768: in_vid.convert()