Search code examples
videoffmpegmpeg-dashmp4box

Is it possible to stream multi framerate videos using MPEG-DASH?


I transcoded a mp4 video to several framerates like 5FPS, 10FPS .. 30FPS and used MP4Box to segment them to play in DASH IF player.

FFMPEG Command to generate multi framerate videos with same resolution:

ffmpeg -i fball.mp4 -f mp4 -vcodec libx264 -profile:v high -vf scale=1280:-1 -b:v 2000k -minrate 2000k -maxrate 2000k -bufsize 2000k -nal-hrd cbr -g 120 -keyint_min 120 -r 60.0 -flags +cgop -sc_threshold 0 -pix_fmt yuv420p -threads 0 -x264opts keyint=120:min-keyint=120:sps-id=1 -an -y fball_720p_60fps.mp4

ffmpeg -i fball.mp4 -f mp4 -vcodec libx264 -profile:v high -vf scale=1280:-1 -b:v 1000k -minrate 1000k -maxrate 1000k -bufsize 1000k -nal-hrd cbr -g 60 -keyint_min 60 -r 30.0 -flags +cgop -sc_threshold 0 -pix_fmt yuv420p -threads 0 -x264opts keyint=60:min-keyint=60:sps-id=1 -an -y fball_720p_30fps.mp4

FFMPEG command to extract audio:

ffmpeg -i fball.mp4 -acodec aac -b:a 128k -vn -strict -2 -y fball_audio.mp4

MP4Box command for segmentation:

MP4Box -frag 2000 -dash 2000 -rap -base-url ./segments/ -profile main -segment-name /segments/%s_ -out dash/fball_dash.mpd fball_720p_24fps.mp4 fball_720p_30fps.mp4 fball_720p_60fps.mp4 fball_audio.mp4

  1. Segment Duration: 2 seconds

  2. GOP length: segment duration x FPS of video

  3. Resolution: 720p for all videos

Result is VIDEO DECODE error or stalls while switching framerate.

Am I making any mistake while transcoding? Is it possible to stream Multi frame rate videos using MPEG DASH?


Solution

  • Adding -profile:dashavc264:onDemand in MP4Box command solved VIDEO DECODE error issue.

    MP4Box -dash 2000 -rap -profile dashavc264:onDemand -out dash/fball_dash.mpd fball_30fps.mp4 fball_60fps.mp4 fball_15fps.mp4 fball_5fps.mp4 fball_audio.mp4