html5 - Encoding FFMPEG to MPEG-DASH – or WebM with Keyframe Clusters – for MediaSource API -
i'm sending video stream chrome, play via mediasource api.
as understand it, mediasource supports mp4 files encoded mpeg-dash, or webm files have clusters beginning keyframes (otherwise raises error: media segment did not begin keyframe).
is there way encode in mpeg-dash or keyframed webm formats ffmpeg in real-time?
edit:
i tried ffmpeg ... -f webm -vcodec vp8 -g 1
every frame keyframe. not ideal solution. work mediastream though. way sync segments keyframes in webm not every frame needs keyframe?
reference questions on webm / mp4 , mediasource:
media source api not working custom webm file (chrome version 23.0.1271.97 m)
at moment ffmpeg not support dash encoding. can segment ffmpeg (https://www.ffmpeg.org/ffmpeg-formats.html#segment_002c-stream_005fsegment_002c-ssegment), recommend combining ffmpeg , mp4box. use ffmpeg transcode live video, , mp4box segment , create .mpd index.
mp4box part of gpac (http://gpac.wp.mines-telecom.fr/).
here example using h264:
ffmpeg -threads 4 -f v4l2 -i /dev/video0 -acodec libfaac -ar 44100 -ab 128k -ac 2 -vcodec libx264 -r 30 -s 1280x720 -f mp4 -y "$movie" > temp1.mp4 && mp4box -dash 10000 -frag 1000 -rap "$movie"
if need vp8 (webm), use: -vcodec libvpx
, -f webm
or -f ts
.
Comments
Post a Comment