This method create a video from still images (jpg or png).
ffmpeg -framerate 1/5 -i etape%01d.jpg -c:v libx264 -vf "fps=25,format=yuv420p" out.mp4
551381
public function createVideoFromImages($path = 'data/etape*.jpg', $target = false, $framerate = '25', $fps = 25)
    {
        try {
            // don't want this service to be a singleton. I have to reset the ffmpeg parameters for each call.
            $this->serviceLocator->setShared('playgroundcore_phpvideotoolkit', false);

            $this->serviceLocator->get('playgroundcore_phpvideotoolkit')
            ->addPreInputCommand('-y')
            ->addPreInputCommand('-framerate', $framerate)
            ->addPreInputCommand('-pattern_type', 'glob')
            ->addCommand('-i', $path)
            ->addCommand('-c:v', 'libx264')
            ->addCommand('-vf', 'fps='. $fps)
            ->addCommand('-pix_fmt', 'yuv420p')
            ->setOutputPath($target)
            ->execute();
        } catch (FfmpegProcessOutputException $e) {
            throw new \PHPVideoToolkit\InvalidArgumentException('Error when merging videos');
        } catch (\PHPVideoToolkit\Exception $e) {
            throw new \PHPVideoToolkit\InvalidArgumentException('Error when merging videos');
        }

        return $target;
    }
834416
def run_capture
      puts '*** Preserving this moment in history.' unless capture_stealth
      self.snapshot_loc = config.raw_image(image_file_type)
      self.main_image   = config.main_image(sha, image_file_type)

      capturer = Platform.capturer_class(capture_animated?).new(
        capture_device: capture_device,
        capture_delay: capture_delay,
        snapshot_location: snapshot_loc,
        video_location: config.video_loc,
        frames_location: config.frames_loc,
        animated_duration: capture_animate
      )
      capturer.capture
    end
915088
def run(self):
        
        if not self.camera.is_running:
            self.camera.start()
        while True:
            if not self.cmd_q.empty():
                cmd = self.cmd_q.get()
                if cmd[0] == 'stop':
                    self.out.close()
                    self.recording = False
                elif cmd[0] == 'start':
                    filename = cmd[1]
                    self.out = si.FFmpegWriter(filename)
                    self.recording = True
                    self.count = 0

            if self.recording:
                if self.count == 0:
                    image, _, _ = self.camera.frames()
                    
                    if self.data_buf is None:
                        self.data_buf = np.zeros([1, image.height, image.width, image.channels])
                    self.data_buf[0,...] = image.raw_data
                    self.out.writeFrame(self.data_buf)

                self.count += 1
                if self.count == self.rate:
                    self.count = 0
237270
function () {
                var el = document.createElement( 'video' ),
                    bool = false;
                // IE9 Running on Windows Server SKU can cause an exception to be thrown, bug #224
                try {
                    if ( bool = !!el.canPlayType ) {
                        bool      = new Boolean(bool);
                        bool.ogg  = el.canPlayType('video/ogg; codecs="theora"')      .replace(/^no$/,'');
                        bool.h264 = el.canPlayType('video/mp4; codecs="avc1.42E01E"') .replace(/^no$/,'');
                        bool.webm = el.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,'');
                    }
    
                } catch(e) {}
                _video = bool;
    
                this.supportVideo = function () { return _video; };
                return this.supportVideo();
            }
162053
def get_thumbnail(self, video_path, at_time=0.5):
        
        filename = os.path.basename(video_path)
        filename, __ = os.path.splitext(filename)
        _, image_path = tempfile.mkstemp(suffix='_{}.jpg'.format(filename))

        video_duration = self.get_media_info(video_path)['duration']
        if at_time > video_duration:
            raise exceptions.InvalidTimeError()
        thumbnail_time = at_time

        cmds = [self.ffmpeg_path, '-i', video_path, '-vframes', '1']
        cmds.extend(['-ss', str(thumbnail_time), '-y', image_path])

        process = self._spawn(cmds)
        self._check_returncode(process)

        if not os.path.getsize(image_path):
            # we somehow failed to generate thumbnail
            os.unlink(image_path)
            raise exceptions.InvalidTimeError()

        return image_path
1216747
def create_video(factory_id, create_video_body, opts = {})
      data, _status_code, _headers = create_video_with_http_info(factory_id, create_video_body, opts)
      return data
    end
1243074
def frame_generator(frame_duration_ms, audio, sample_rate):
    
    n = int(sample_rate * (frame_duration_ms / 1000.0) * 2)
    offset = 0
    timestamp = 0.0
    duration = (float(n) / sample_rate) / 2.0
    while offset + n < len(audio):
        yield Frame(audio[offset:offset + n], timestamp, duration)
        timestamp += duration
        offset += n
26910
def anim_to_html(anim, fps=None, embed_frames=True, default_mode='loop'):
    """"""
    if fps is None and hasattr(anim, '_interval'):
        # Convert interval in ms to frames per second
        fps = 1000. / anim._interval

    plt.close(anim._fig)
    if hasattr(anim, "_html_representation"):
        return anim._html_representation
    else:
        # tempfile can't be used here: we need a filename, and this
        # fails on windows.  Instead, we use a custom filename generator
        #with tempfile.NamedTemporaryFile(suffix='.html') as f:
        with _NameOnlyTemporaryFile(suffix='.html') as f:
            anim.save(f.name,  writer=HTMLWriter(fps=fps,
                                                 embed_frames=embed_frames,
                                                 default_mode=default_mode))
            html = open(f.name).read()

        anim._html_representation = html
        return html
933837
def retime_by_framerate(have, want)
      ratio = want.fps.to_f / have.fps.to_f
      have.subtitles.each do |subtitle|
        subtitle[:start] *= ratio
        subtitle[:end] *= ratio
      end
    end
315036
def raw_to_fp(self):
        
        sort = fp.fp.FSort.from_size(self.length)
        return fp.fpToFP(self, sort)
1366436
function ffmpeg(os) {
  var stdio = os.stdio===undefined? STDIO:os.stdio;
  return new Promise((fres, frej) => cp.exec(command(os), {stdio}, (err, stdout, stderr) => {
    if(err) frej(err);
    else fres({stdout, stderr});
  }));
}
191712
def encode(self, source_path, target_path, params):  # NOQA: C901
        
        total_time = self.get_media_info(source_path)['duration']

        cmds = [self.ffmpeg_path, '-i', source_path]
        cmds.extend(self.params)
        cmds.extend(params)
        cmds.extend([target_path])

        process = self._spawn(cmds)

        buf = output = ''
        # update progress
        while True:
            # any more data?
            out = process.stderr.read(10)
            if not out:
                break

            out = out.decode(console_encoding)
            output += out
            buf += out

            try:
                line, buf = buf.split('\r', 1)
            except ValueError:
                continue

            try:
                time_str = RE_TIMECODE.findall(line)[0]
            except IndexError:
                continue

            # convert progress to percent
            time = 0
            for part in time_str.split(':'):
                time = 60 * time + float(part)

            percent = time / total_time
            logger.debug('yield {}%'.format(percent))
            yield percent

        if os.path.getsize(target_path) == 0:
            raise exceptions.FFmpegError("File size of generated file is 0")

        # wait for process to exit
        self._check_returncode(process)

        logger.debug(output)
        if not output:
            raise exceptions.FFmpegError("No output from FFmpeg.")

        yield 100
996813
def videogrep(inputfile, outputfile, search, searchtype, maxclips=0, padding=0, test=False, randomize=False, sync=0, use_transcript=False, use_vtt=False, export_clips=False):
    

    padding = padding / 1000.0
    sync = sync / 1000.0
    composition = []
    foundSearchTerm = False

    if use_transcript:
        composition = compose_from_transcript(inputfile, search, searchtype)
    elif use_vtt:
        vtts = get_vtt_files(inputfile)
        composition = compose_from_vtt(vtts, search, searchtype)
    else:
        srts = get_subtitle_files(inputfile)
        composition = compose_from_srts(srts, search, searchtype)


    # If the search term was not found in any subtitle file...
    if len(composition) == 0:
        print("[!] Search term '" + search + "'" + " was not found in any file.")
        exit(1)

    else:
        print("[+] Search term '" + search + "'" + " was found in " + str(len(composition)) + " places.")

        # apply padding and sync
        for c in composition:
            c['start'] = c['start'] + sync - padding
            c['end'] = c['end'] + sync + padding

        if maxclips > 0:
            composition = composition[:maxclips]

        if randomize is True:
            random.shuffle(composition)

        if test is True:
            demo_supercut(composition, padding)
        else:
            if os.path.splitext(outputfile)[1].lower() == '.edl':
                make_edl(composition, outputfile)
            elif export_clips:
                split_clips(composition, outputfile)
            else:
                if len(composition) > BATCH_SIZE:
                    print("[+} Starting batch job.")
                    create_supercut_in_batches(composition, outputfile, padding)
                else:
                    create_supercut(composition, outputfile, padding)
686885
def save(self, *args, **kwargs):
        """"""

        super(MP4, self).save(*args, **kwargs)
162603
function getLiveStream(options) {
    return raspivid(Object.assign({
        width: 960,
        height: 540,
        framerate: 20,
        profile: 'baseline',
        timeout: 0
    }, options))
    .pipe(new Splitter(NALseparator))
    .pipe(new stream.Transform({ transform: function (chunk, encoding, callback) {
        const chunkWithSeparator = Buffer.concat([NALseparator, chunk]);

        const chunkType = chunk[0] & 0b11111;

        // Capture the first SPS & PPS frames, so we can send stream parameters on connect.
        if (chunkType === 7 || chunkType === 8) {
            headerData.addParameterFrame(chunkWithSeparator);
        } else {
            // The live stream only includes the non-parameter chunks
            this.push(chunkWithSeparator);

            // Keep track of the latest IDR chunk, so we can start clients off with a near-current image
            if (chunkType === 5) {
                headerData.idrFrame = chunkWithSeparator;
            }
        }

        callback();
    }}));
}
81903
function () {

			var images = {};
			var blobs = {};

			if ( 'Video' in fbxTree.Objects ) {

				var videoNodes = fbxTree.Objects.Video;

				for ( var nodeID in videoNodes ) {

					var videoNode = videoNodes[ nodeID ];

					var id = parseInt( nodeID );

					images[ id ] = videoNode.RelativeFilename || videoNode.Filename;

					// raw image data is in videoNode.Content
					if ( 'Content' in videoNode ) {

						var arrayBufferContent = ( videoNode.Content instanceof ArrayBuffer ) && ( videoNode.Content.byteLength > 0 );
						var base64Content = ( typeof videoNode.Content === 'string' ) && ( videoNode.Content !== '' );

						if ( arrayBufferContent || base64Content ) {

							var image = this.parseImage( videoNodes[ nodeID ] );

							blobs[ videoNode.RelativeFilename || videoNode.Filename ] = image;

						}

					}

				}

			}

			for ( var id in images ) {

				var filename = images[ id ];

				if ( blobs[ filename ] !== undefined ) images[ id ] = blobs[ filename ];
				else images[ id ] = images[ id ].split( '\\' ).pop();

			}

			return images;

		}
1199986
def genH264(infile, outfile, T):
    
    x264opts="-x264opts keyint=10:min-keyint=10:bframes=0"
    h264_dummystream_flavor="-pix_fmt yuv420p -vprofile main" 

    opts="-vcodec h264 "+h264_dummystream_flavor+" "+x264opts+" -fflags +genpts -r 25 -t "+str(T)
    com="ffmpeg -y -loop 1 -fflags +genpts -r 25 -i "+infile+" "+opts+" "+outfile
    print(com)
    os.system(com)