Using ffprobe to check if file is audio or video only

To output the codec_type ffprobe -loglevel error -show_entries stream=codec_type -of default=nw=1 input.foo Example result: codec_type=video codec_type=audio If you have multiple audio or video streams the output will show multiple video or audio entries. Same as above but output just the values ffprobe -loglevel error -show_entries stream=codec_type -of default=nw=1=nk=1 input.foo or: ffprobe -loglevel error -show_entries stream=codec_type … Read more

HTML5 Video: Force abort of buffering

Ok, so for the last few day’s I’ve really been struggling with this issue. Here is my analysis and solution: In short the problem I tried to solve: I noticed that the HTML5 player does not stop downloading when the player is paused (at all, not even after a reasonable amount of time). Working with … Read more

Fetch frame count with ffmpeg

ffprobe ffprobe -v error -select_streams v:0 -count_packets -show_entries stream=nb_read_packets -of csv=p=0 input.mp4 This actually counts packets instead of frames but it is much faster. Result should be the same. If you want to verify by counting frames change -count_packets to -count_frames and nb_read_packets to nb_read_frames. What the ffprobe options mean -v error This hides “info” … Read more

html5: display video inside canvas

var canvas = document.getElementById(‘canvas’); var ctx = canvas.getContext(‘2d’); var video = document.getElementById(‘video’); video.addEventListener(‘play’, function () { var $this = this; //cache (function loop() { if (!$this.paused && !$this.ended) { ctx.drawImage($this, 0, 0); setTimeout(loop, 1000 / 30); // drawing at 30fps } })(); }, 0); I guess the above code is self Explanatory, If not drop … Read more