Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multibitrate MPEG-DASH failed to create #2876

Open
3 tasks done
alex-rsk opened this issue Jun 13, 2024 · 4 comments
Open
3 tasks done

Multibitrate MPEG-DASH failed to create #2876

alex-rsk opened this issue Jun 13, 2024 · 4 comments

Comments

@alex-rsk
Copy link

alex-rsk commented Jun 13, 2024

  • I looked for a similar issue and couldn't find any.
  • I tried with the latest version of GPAC. Installers available at https://gpac.io/downloads/gpac-nightly-builds/
  • I give enough information for contributors to reproduce my issue (meaningful title, github labels, platform and compiler, command-line ...).

Greetings.

I continue my attempts to make Mpeg-dash stream with adaptive bitrate. It is related with issue 2868.

In order to achieve this, I'm trying to rescale with MP4Box on the fly.

MP4Box -dash 2000 \
 -dash-ctx /dev/shm/broadcast/context.txt -profile dashavc264:live \
--utcs="https://time.akamai.com/?iso&ms" \
-mpd-refresh 2  \ 
-dynamic \
-bs-switching merge \
 -segment-timeline -url-template \
 -insert-utc  \
-min-buffer 15 \
 -mpd-title "Test ABR" \
 -time-shift 30 \
/dev/shm/broadcast/input.mp4#video:dur=10:@ffsws:osize=160x120@enc:c=avc:b=100k:#Representation=Rep1@@ffsws:osize=320x240@enc:c=avc:b=200k:#Representation=Rep2 \
/dev/shm/broadcast/input.mp4#audio:dur=10  \
 -out /dev/shm/broadcast/manifest.mpd  

First run is successfull
Second run brings errors and stream doesn't play after first segment.

Command /usr/local/bin/MP4Box -dash 2000 -dash-ctx /dev/shm/broadcast/context.txt -profile dashavc264:live --utcs="https://time.akamai.com/?iso&ms" -mpd-refresh 2 -dynamic -bs-switching merge -segment-timeline -url-template -insert-utc -min-buffer 15 -mpd-title "Luuv" -time-shift 30 /dev/shm/broadcast/input.mp4#video:dur=10:@ffsws:osize=160x120@enc:c=avc:b=100k:#Representation=Rep1@@ffsws:osize=320x240@enc:c=avc:b=200k:#Representation=Rep2 /dev/shm/broadcast/input.mp4#audio:dur=10 -out /dev/shm/broadcast/manifest.mpd  
[2024-06-13 10:33:16] local.DEBUG: 5: [Dasher] No template assigned, using $File$_dash$FS$$Time$
[FFSWS] Converting from 640x480@yuv420 to 160x120@yuv420                                                                              
[FFSWS] Setup rescaler from 640x480 fmt yuv420 to 160x120 fmt yuv420                                                                  
[FFSWS] Converting from 640x480@yuv420 to 320x240@yuv420                                                                              
[FFSWS] Setup rescaler from 640x480 fmt yuv420 to 320x240 fmt yuv420                                                                  
[FFSWS] Converting from 640x480@yuv420 to 160x120@yuv420                                                                              
[FFSWS] Setup rescaler from 640x480 fmt yuv420 to 160x120 fmt yuv420                                                                  
[FFSWS] Converting from 640x480@yuv420 to 320x240@yuv420                                                                              
[FFSWS] Setup rescaler from 640x480 fmt yuv420 to 320x240 fmt yuv420                                                                  
[Dasher] Synchronized clock to remote https://time.akamai.com/?iso&ms - UTC diff (local - remote) 7 ms                                
[AVC|H264] Possible Variable Frame Rate: VUI "fixed_frame_rate_flag" absent                                                           
[AVC|H264] Possible Variable Frame Rate: VUI "fixed_frame_rate_flag" absent                                                           
[Dasher] Input /dev/shm/broadcast/input.mp4: max audio duration 9928/1000 in the period is less than duration 10000/1000, clamping will happen                                                                                                                   
[Dasher] Input /dev/shm/broadcast/input.mp4: max audio duration 9928/1000 in the period is less than duration 10000/1000, clamping will happen                                                                                                                   
[Dasher] AS-1 Rep 1 segment 6 done 1325 ms before UTC due time                                                                        
[Dasher] updated period DID1 duration 11981 MPD time 11981                                                                            
[MPD] Generating MPD at time 2024-06-13T10:33:15.688Z                                                                                 
[Dasher] AS-1 Rep 1 segment 7 done 3319 ms before UTC due time                                                                        
[Dasher] updated period DID1 duration 13978 MPD time 13978                                                                            
[MPD] Generating MPD at time 2024-06-13T10:33:15.691Z                                                                                 
[Dasher] AS-1 Rep 1 segment 8 done 5318 ms before UTC due time                                                                        
[Dasher] updated period DID1 duration 15980 MPD time 15980                                                                            
[MPD] Generating MPD at time 2024-06-13T10:33:15.694Z                                                                                 
[Dasher] AS-1 Rep 1 segment 9 done 7312 ms before UTC due time                                                                        
[Dasher] updated period DID1 duration 17977 MPD time 17977                                                                            
[MPD] Generating MPD at time 2024-06-13T10:33:15.697Z                                                                                 
[Dasher] AS-1 Rep 1 segment 10 done 9332 ms before UTC due time                                                                       
[Dasher] updated period DID1 duration 19927 MPD time 1992700s (100.00 %) AS#2.2(V) done (6 segs)                                      
[MPD] Generating MPD at time 2024-06-13T10:33:15.701Z                                                                                 
[Dasher] updated period DID1 duration 19927 MPD time 1992700s (100.00 %) AS#2.2(V) done (6 segs) / MPD 10.80s 102 %                   
[MPD] Generating MPD at time 2024-06-13T10:33:15.708Z     
                                                                            
[Filter] dasher (idx 11) not responding properly: 100000 consecutive process with no packet discarded or sent, but 3 packets pending  
        discarding all inputs and notifying end of stream on all outputs                                                              
[MP4Mux] PID has no input packet and configuration not known after 10 retries, aborting initial timing sync                           
[MP4Mux] Unable to setup fragmentation for track ID 0: Bad Parameter                                                                  
Error DASHing file: Bad Parameter               

How I can make multiple bitrate versions another way?

@jeanlf
Copy link
Member

jeanlf commented Jun 13, 2024

Could you post the video files associated with first run and second run ? I suspect their duration do not match the segment duration specified.

You can also try adding --force_flush to your command line.

@alex-rsk
Copy link
Author

Could you post the video files associated with first run and second run ? I suspect their duration do not match the segment duration specified.

Sure

https://www.dropbox.com/scl/fo/lnja9qg6brspee7a627eh/ANoENOz5nAhQt_UWyxJOvuc?rlkey=97wc2cqoafl5gs8gihzbz7pbw&st=p7zddlmt&dl=0

Thank you very much. I'll try force-flush soon.

@alex-rsk
Copy link
Author

alex-rsk commented Jun 13, 2024

Version with --dash=10000 and --force_flush is acting!
Thank you, savior.

But what if I want to chop 10s segments to lesser fragments to decrease latency? Should I add i.e -frag 1000?

jeanlf added a commit that referenced this issue Jun 20, 2024
- added option sflush to avoid loop/period break  - cf #2876
- fixed bugs in context reloading breaking timing and last active period detection
- disable forced clampig when using segment flush option
- deprecating force_flush (use sflush=single)
- updated doc
@jeanlf
Copy link
Member

jeanlf commented Jun 20, 2024

Nope, -frag only controls fragments (moof+mdat), not segments.

I had to rework a bit more the dasher context for this use case, so --force_flush is being deprecated in favor of --sflush.
For your use case, using --sflush=end will allow generating 2s segments but will not close period/loop at end .

Could you cross-check ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants