3

I'm stucked on this issue for a couple of days, couldn't find a perfect working example.

Here's my current method:

Step 1.

ffmpeg -re -i sample.mp4 -threads 0 -y \
-map 0:1 -vn -acodec aac -strict -2 -ar 48000 -ac 2 \
-f segment -segment_time 4 -segment_format mpegts Dash\audio_%d.ts \
-map 0:0 -vcodec libx264 -vprofile baseline -preset veryfast \
-s 640x360 -vb 512k -bufsize 1024k -maxrate 512k -level 31 -keyint_min 25 -g 25 \
-sc_threshold 0 -an -bsf h264_mp4toannexb -flags -global_header \
-f segment -segment_time 4 -segment_format mpegts Dash\video_%d.ts

Step 2.

mp4box -add Dash\audio_%d.ts Output\audio_%d.ts.mp4
mp4box -add Dash\video_%d.ts Output\video_%d.ts.mp4

Step 3.

mp4box -dash-ctx Output\dash-live.txt -dash 4000 \
-rap -ast-offset 12 -no-frags-default -bs-switching no \
-min-buffer 4000 -url-template -time-shift 1800 \
-segment-name live_$RepresentationID$_ -out Output\live \
-dynamic -mpd-refresh 2 -subsegs-per-sidx -1 Output\audio_%d.ts.mp4:id=audio Output\video_%d.ts.mp4:id=video

I played the live.mpd generated using Dash.js, the player paused a long time before actually playing, and freeze every time getting a new m4s file.

Are there any wrong on my commands? Or it would be great if can provide any other good examples.

BartMao
  • 601
  • 7
  • 18

0 Answers0