Exemple #1
0
    def update_transcoding_status(self):
        '''Check if video transcoding is over'''

        from wall.videotranscoder import VideoTranscoder
        video_transcoder = VideoTranscoder()
        
        log.debug('Checking transcoding status of video %s', self)

        if self.status == 'Transcoding' and not video_transcoder.is_running(self.original_path):
            log.info('Transcoding finished for video %s', self)

            self.status = 'Completed'
            self.save()
Exemple #2
0
    def start_transcoding(self):
        from wall.videotranscoder import VideoTranscoder
        video_transcoder = VideoTranscoder()

        if self.status == 'New':
            # Set paths
            prefix = self.original_path[:-4]
            self.webm_path = prefix + '.webm'
            self.mp4_path = prefix + '.mp4'
            self.ogv_path = prefix + '.ogv'
            self.image_path = prefix + '.jpg'

            # Thumb
            video_transcoder.generate_thumbnail(self.full_path(self.original_path), self.full_path(self.image_path))
            
            self.status = 'Queued'
            self.save()

        if self.status == 'Queued' and video_transcoder.has_free_slot():
            log.info('Starting transcoding of video %s', self)

            # WebM
            video_transcoder.transcode_webm(self.full_path(self.original_path), self.full_path(self.webm_path))

            self.status = 'Transcoding'
            self.save()