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

Playback stops using live streaming from FFMPEG #351

Closed
aletorrado opened this issue Apr 22, 2016 · 8 comments
Closed

Playback stops using live streaming from FFMPEG #351

aletorrado opened this issue Apr 22, 2016 · 8 comments
Labels
status: archived Archived and locked; will not be updated type: bug Something isn't working correctly
Milestone

Comments

@aletorrado
Copy link

aletorrado commented Apr 22, 2016

Hi, I'm testing a few FFMPEG commands to stream to Shaka v2.0.0-beta. Some of them works OK with Shaka 1.5, but not with this version.

ffmpeg -i <live-stream> -f dash manifest.mpd
ffmpeg -i <live-stream> -f dash manifest.mpd
ffmpeg -i <live-stream> -x264opts 'keyint=25:scenecut=-1' -f dash manifest.mpd
ffmpeg -i <live-stream> -x264opts 'keyint=25:scenecut=-1' -f dash -use_template false manifest.mpd
Using any of these commands, playback suddenly stops after less than a minute usually. Shaka keeps fetching the manifest with the new chunks, but does not play anymore. Using Shaka 1.5 it seems OK.

ffmpeg -i <live-stream> -x264opts 'keyint=25:scenecut=-1' -f dash -use_timeline false manifest.mpd
Everything seems OK with this using any version of Shaka.

I would like to keep x264 scene detection, using flexible segment times with SegmentTemplate and SegmentTimeline, for maximum performance.

Notice that when the live streaming has ended, FFMPEG converts the manifest to type="static". Then any version of Shaka seems to play OK any of those commands. Problems happen only while in dynamic mode.

@tdrews
Copy link
Contributor

tdrews commented Apr 22, 2016

Can you try from master with verbose logging enabled?

@tdrews tdrews added type: bug Something isn't working correctly type: question A question from the community labels Apr 22, 2016
@aletorrado
Copy link
Author

aletorrado commented Apr 22, 2016

I cannot find where to enable verbose mode. Can you help me?

Examples on the debugging tutorial seems outdated:
shaka.log.setLevel(shaka.log.Level.DEBUG);

Thanks

@tdrews
Copy link
Contributor

tdrews commented Apr 22, 2016

You can either call shaka.log.setLevel(shaka.log.Level.V2) from your application or you can add ?vv onto the end of your demo page, e.g., http://localhost/shaka/demo/?vv. Note that in both cases you need to be using the uncompiled library.

@tdrews
Copy link
Contributor

tdrews commented Apr 28, 2016

Hi, any updates on this? Working / not working from master?

@aletorrado
Copy link
Author

Let me test it. I'll come back here soon with that info.

@aletorrado
Copy link
Author

aletorrado commented Apr 28, 2016

It isn't working at all for me right now (even without using SegmentTimeline, as the example below). Using dash.js everything is OK. When I stop the broadcast, and switch the manifest from type=dynamic to type=static, shaka is able to play it.

Btw. all test were done streaming from localhost, to ensure no timing issues

This work:

<?xml version="1.0" encoding="utf-8"?>
<MPD xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="urn:mpeg:dash:schema:mpd:2011"
    xmlns:xlink="http://www.w3.org/1999/xlink"
    xsi:schemaLocation="urn:mpeg:DASH:schema:MPD:2011 http://standards.iso.org/ittf/PubliclyAvailableStandards/MPEG-DASH_schema_files/DASH-MPD.xsd"
    profiles="urn:mpeg:dash:profile:isoff-live:2011"
    type="static"
    mediaPresentationDuration="PT2M25.7S"
    minBufferTime="PT5.0S">
    <ProgramInformation>
    </ProgramInformation>
    <Period start="PT0.0S">
        <AdaptationSet contentType="video" segmentAlignment="true" bitstreamSwitching="true" frameRate="30/1">
            <Representation id="0" mimeType="video/mp4" codecs="avc1.64001e" bandwidth="300000" width="640" height="360" frameRate="30/1">
                <SegmentTemplate timescale="1000000" duration="5000000" initialization="init-stream$RepresentationID$.m4s" media="chunk-stream$RepresentationID$-$Number%05d$.m4s" startNumber="1">
                </SegmentTemplate>
            </Representation>
        </AdaptationSet>
        <AdaptationSet contentType="audio" segmentAlignment="true" bitstreamSwitching="true">
            <Representation id="1" mimeType="audio/mp4" codecs="mp4a.40.2" bandwidth="96000" audioSamplingRate="44100">
                <AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2" />
                <SegmentTemplate timescale="1000000" duration="5000000" initialization="init-stream$RepresentationID$.m4s" media="chunk-stream$RepresentationID$-$Number%05d$.m4s" startNumber="1">
                </SegmentTemplate>
            </Representation>
        </AdaptationSet>
    </Period>
</MPD>

This doesn't:

<?xml version="1.0" encoding="utf-8"?>
<MPD xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="urn:mpeg:dash:schema:mpd:2011"
    xmlns:xlink="http://www.w3.org/1999/xlink"
    xsi:schemaLocation="urn:mpeg:DASH:schema:MPD:2011 http://standards.iso.org/ittf/PubliclyAvailableStandards/MPEG-DASH_schema_files/DASH-MPD.xsd"
    profiles="urn:mpeg:dash:profile:isoff-live:2011"
    type="dynamic"
    minimumUpdatePeriod="PT500S"
    suggestedPresentationDelay="PT5S"
    availabilityStartTime="2016-04-28T22:40:45"
    publishTime="2016-04-28T22:42:29"
    minBufferTime="PT5.0S">
    <ProgramInformation>
    </ProgramInformation>
    <Period start="PT0.0S">
        <AdaptationSet contentType="video" segmentAlignment="true" bitstreamSwitching="true" frameRate="30/1">
            <Representation id="0" mimeType="video/mp4" codecs="avc1.64001e" bandwidth="300000" width="640" height="360" frameRate="30/1">
                <SegmentTemplate timescale="1000000" duration="5000000" initialization="init-stream$RepresentationID$.m4s" media="chunk-stream$RepresentationID$-$Number%05d$.m4s" startNumber="1">
                </SegmentTemplate>
            </Representation>
        </AdaptationSet>
        <AdaptationSet contentType="audio" segmentAlignment="true" bitstreamSwitching="true">
            <Representation id="1" mimeType="audio/mp4" codecs="mp4a.40.2" bandwidth="96000" audioSamplingRate="44100">
                <AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2" />
                <SegmentTemplate timescale="1000000" duration="5000000" initialization="init-stream$RepresentationID$.m4s" media="chunk-stream$RepresentationID$-$Number%05d$.m4s" startNumber="1">
                </SegmentTemplate>
            </Representation>
        </AdaptationSet>
    </Period>
</MPD>

Hope this helps.

@aletorrado
Copy link
Author

aletorrado commented Apr 29, 2016

This commit broke it all: 1108700

@tdrews tdrews removed the type: question A question from the community label Apr 29, 2016
@tdrews tdrews self-assigned this Apr 29, 2016
@tdrews tdrews added this to the v2.0.0 milestone Apr 29, 2016
shaka-bot pushed a commit that referenced this issue May 3, 2016
This patch also enables presentations to start in live mode
and end in VOD mode.

Issue #351

Change-Id: Idc0ad0c69887d61d080f844ef388222d1228a535
@tdrews
Copy link
Contributor

tdrews commented May 3, 2016

With 294bcca you should be able to use
ffmpeg -i <live-stream> -f dash manifest.mpd
and
ffmpeg -i <live-stream> -x264opts 'keyint=25:scenecut=-1' -f dash manifest.mpd
in dynamic mode (Shaka should automatically switch to static mode after the final manifest update as well).

However, using -use_template false or -use_timeline false may not work in dynamic mode. This is because when using these options ffmpeg may vary the segment duration (i.e., it may vary SegmentList@duration and SegmentTemplate@duration) between manifest updates; this is rather unusual and likely not spec compliant (although when ffmpeg does this it outputs warnings indicating that SegmentTimeline should be used).

(Also, be sure to delete the old manifest before re-starting ffmpeg as ffmpeg doesn't overwrite the manifest right away.)

@tdrews tdrews closed this as completed May 5, 2016
@shaka-project shaka-project locked and limited conversation to collaborators Mar 22, 2018
@shaka-bot shaka-bot added the status: archived Archived and locked; will not be updated label Apr 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: archived Archived and locked; will not be updated type: bug Something isn't working correctly
Projects
None yet
Development

No branches or pull requests

3 participants