UPDATE: this is fake news, see my newer post for more info.
It seems that neither iOS devices, nor Safari on OS X, support mp4; so if you’re trying to stream video, you need to provide another format.
The recommendation is to use HLS, which fortunately is supported by ffmpeg, you merely need to adjust your incantation:
app.get('/hls/video', function(req, res) { res.contentType('application/vnd.apple.mpegurl'); var proc = ffmpeg(); proc.stdout.pipe(res); }); function ffmpeg() { var cmd = "ffmpeg"; var filter = "some complex filter expr"; var args = ["-i", "video1.mp4"]; ... args.push( "-vcodec", "libx264", "-f", "hls", "-hls_time", "9", "-hls_list_size", "0", "-profile:v", "baseline", "-level", "3.0", "pipe:1" ); return spawn(cmd, args); }
I could probably use conneg to decide which format to return, rather than the uri, but I’m not convinced that my caching infrastructure (varnish and cloudfront now!) would handle that correctly.
One thought on “Streaming video to iOS devices”