Giter Site home page Giter Site logo

twitchtv / acm-mmsys-2020-grand-challenge Goto Github PK

View Code? Open in Web Editor NEW
41.0 41.0 20.0 52.64 MB

Assets for Twitch's ACM MMSys 2020 Grand Challenge

License: Apache License 2.0

Shell 0.06% Python 0.32% JavaScript 75.81% CSS 0.63% HTML 5.53% Java 17.64% TypeScript 0.01% Batchfile 0.01%

acm-mmsys-2020-grand-challenge's People

Contributors

johnbartos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

acm-mmsys-2020-grand-challenge's Issues

Version For Node and Grunt

Hi,

While setting up the project and when i run grunt dev, i get this error.

sam@mac dash.js % grunt dev
Loading "jscs.js" tasks...ERROR
>> ReferenceError: primordials is not defined

Running "browserSync:bsFiles" (browserSync) task
[HTML Injector] Running...
[Browsersync] Access URLs:

   Local: http://localhost:3000/samples/index.html
External: http://192.168.0.103:3000/samples/index.html

      UI: http://localhost:3001

UI External: http://localhost:3001

[Browsersync] Serving files from: ./
[Browsersync] Watching files...

Running "browserify:watch_dev" (browserify) task

/Users/sam/mmsys/acm-mmsys-2020-grand-challenge-master/dash.js/index.js:31
import { MediaPlayer } from './index_mediaplayerOnly';
^
ParseError: 'import' and 'export' may appear only with 'sourceType: module'
Warning: Error running grunt-browserify. Use --force to continue.

Aborted due to warnings.

Execution Time (2021-09-29 21:04:18 UTC-4)
loading tasks 1.5s ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 57%
browserSync:bsFiles 552ms ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 21%
browserify:watch_dev 584ms ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 22%
Total 2.6s

What could be the reason for this error? is it a version mismatch between node and grunt.

I use node version 14.15.1 , grunt version 1.4.1 and grunt-cli version 1.4.3

Loading own ABR rule

Hello. I am trying to import my custom ABR rule in 'index.html', in order to direct the player to use my 'CustomRule' instead of the Default ABR settings ('useDefaultABRRules': false).

Although all include directories seem to be set correctly, I get the following error:

Uncaught ReferenceError: CustomRule is not defined.

Via a search online, I have found that this is typically related to jQuery not being referenced (which in my case it is). Has anyone experienced a similar problem, or has any suggestions on how to resolve it?

Here is my index.html:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8"/>
    <title>Low latency live stream instantiation example</title>   
    <script src="../../dist/dash.all.debug.js"></script>
    <script src="http://code.jquery.com/jquery-3.4.1.min.js"></script>
    <script type='module' src="./CustomRule.js"></script>
    <!--dash.all.min.js should be used in production over dash.all.debug.js
        Debug files are not compressed or obfuscated making the file size much larger compared with dash.all.min.js-->
    <!--<script src="../../dist/dash.all.min.js"></script>-->
     

    <script class="code">
        var player, targetLatency, minDrift, catchupPlaybackRate;

        function init() {
            var video,
                url  = 'http://localhost:9001/live/live.mpd';

            video = document.querySelector("video");
            player = dashjs.MediaPlayer().create();
            player.initialize(video, url, true);
            player.updateSettings({ 'streaming': { 'lowLatencyEnabled': true }});
            player.updateSettings({'debug': {'logLevel': dashjs.Debug.LOG_LEVEL_WARNING }});
            player.updateSettings({
            'streaming': {
                'abr': {
                    'useDefaultABRRules': false //in case of own abr algo development
                }
            }
        });
            // add my custom quality switch rule.
            player.addABRCustomRule('qualitySwitchRules', 'CustomRule', CustomRule);
            applyParameters();

            return player;
        }

        function applyParameters() {
            targetLatency = parseFloat(document.getElementById("target-latency").value, 10);
            minDrift = parseFloat(document.getElementById("min-drift").value, 10);
            catchupPlaybackRate = parseFloat(document.getElementById("catchup-playback-rate").value, 10);

            player.updateSettings({
                'streaming': {
                    'liveDelay': targetLatency,
                    'liveCatchUpMinDrift': minDrift,
                    'liveCatchUpPlaybackRate': catchupPlaybackRate
                }
            });
        }
    </script>

    <style>
        .video-wrapper {
            display: flex;
            flex-flow: row wrap;
        }

        .video-wrapper > div:nth-child(2) {
            margin-left: 25px;
        }

        video {
            width: 640px;
            height: 360px;
        }

        ul {
            margin: 0;
        }

        input {
            width: 5em;
            border: 1px solid gray;
            padding: 0 4px 0 8px;
        }

        .help-container {
            display: flex;
            flex-flow: row wrap;
            margin-top: 1em;
            align-content: center;
            background: white;
            border: solid 1px #ddd;
            padding: 0.5em;
        }

        .help-container > div {
            width: 33.3%;
            padding: 1em;
            box-sizing: border-box;
        }

        .help-container h3 {
            margin-top: 0;
        }
    </style>
</head>
<body>
<div>
    <div class="video-wrapper">
        <video controls="true" autoplay muted></video>
        <div>
            <div>
                <form action="javascript:applyParameters()">
                    <fieldset>
                        <legend>Configurable parameters</legend>
                        <p>Target Latency (secs): <input type="number" id="target-latency" value="1" min="0" step="0.1"></p>
                        <p>Min. drift (secs): <input type="number" id="min-drift" value="0.05" min="0.0" max="0.5" step="0.01"></p>
                        <p>Catch-up playback rate (%): <input type="number" id="catchup-playback-rate" value="0.5" min="0.0" max="0.5" step="0.01"></p>
                        <button type="submit">Apply</button>
                    </fieldset>
                </form>
            </div>
            <br>
            <fieldset>
                <legend>Current values</legend>
                <ul>
                    <li>Latency: <span id="latency-tag"></span></li>
                    <li>Min. drift: <span id="mindrift-tag"></span></li>
                    <li>Playback rate: <span id="playbackrate-tag"></span></li>
                    <li>Buffer: <b><span id="buffer-tag"></span></b></li>
                    <li>Quality: <b><span id="quality-tag"></span></b></li>
                </ul>
                <div id="stats"></div>
            </fieldset>
        </div>
    </div>

    <p style="font-family:Arial,sans-serif; font-weight: bold; font-size: 1.1em">Concepts definition</p>
    <div class="help-container">
        <div id="latency-help">
            <h3>Latency</h3>
            <p>Lowering this value will lower latency but may decrease the player's ability to build a stable buffer.</p>
            <p><a href="http://cdn.dashjs.org/latest/jsdoc/module-MediaPlayer.html#setLiveDelay__anchor" target="_blank">setLiveDelay() doc</a></p>
        </div>

        <div id="min-drift-help">
            <h3>Min. drift</h3>
            <p>Minimum latency deviation allowed before activating catch-up mechanism.</p>
            <p><a href="http://cdn.dashjs.org/latest/jsdoc/module-MediaPlayer.html#setLowLatencyMinDrift__anchor" target="_blank">setLowLatencyMinDrift() doc</a></p>
        </div>

        <div id="catch-up-playback-rate-help">
            <h3>Catch-up playback rate</h3>
            <p>Maximum catch-up rate, as a percentage, for low latency live streams.</p>
            <p><a href="http://cdn.dashjs.org/latest/jsdoc/module-MediaPlayer.html#setCatchUpPlaybackRate__anchor" target="_blank">setCatchUpPlaybackRate() doc</a></p>
        </div>
    </div>
</div>
<script>
    document.addEventListener("DOMContentLoaded", function () {
        const player = init();
        const video = document.querySelector("video")
        let stallingAt = null;
        const CMA = () => {
            let average = 0;
            let count = 0;

            return {
                average(val) {
                    if (isNaN(val)) {
                        return 0;
                    }
                    average = average + ((val - average) / ++count);
                    return average;
                },
            }
        }

        setInterval(function() {
                var dashMetrics = player.getDashMetrics();
                var settings = player.getSettings();

                var currentLatency = parseFloat(player.getCurrentLiveLatency(), 10);
                document.getElementById("latency-tag").innerHTML = currentLatency + " secs";

                document.getElementById("mindrift-tag").innerHTML = settings.streaming.liveCatchUpMinDrift + " secs";

                var currentPlaybackRate = player.getPlaybackRate();
                document.getElementById("playbackrate-tag").innerHTML = Math.round(currentPlaybackRate * 100) / 100;

                var currentBuffer = dashMetrics.getCurrentBufferLevel("video");
                document.getElementById("buffer-tag").innerHTML = currentBuffer + " secs";
            }, 200);

            player.on(dashjs.MediaPlayer.events.QUALITY_CHANGE_REQUESTED, (e) => {
                console.warn('Quality changed requested', e);
            });

            player.on(dashjs.MediaPlayer.events.QUALITY_CHANGE_RENDERED, (e) => {
                console.warn('Quality changed', e);
                const quality = player.getBitrateInfoListFor('video')[e.newQuality];
                if (!quality) {
                    return;
                }
                document.querySelector('#quality-tag').innerText = `${quality.width}x${quality.height}, ${quality.bitrate / 1000}Kbps`;
            });

        window.startRecording = () => {
            console.info('Begin recording');

            const latencyCMA = CMA();
            const bufferCMA = CMA();
            const history = window.abrHistory = {
                switchHistory: [],
                stallDuration: 0,
                averageLatency: 0,
                averageBufferLength: 0,
            };

            // Record the initial quality
            recordSwitch(player.getBitrateInfoListFor('video')[player.getQualityFor('video')]);

            let pollInterval = -1;
            window.stopRecording = () => {
                clearInterval(pollInterval);
                checkStallResolution();
                const lastQuality = history.switchHistory[history.switchHistory.length - 1];
                if (lastQuality.end === null) {
                    lastQuality.end = video.currentTime;
                }
                console.warn('Run ended. Please navigate back to node for results.');
            }

            pollInterval = setInterval(function() {
                const currentLatency = parseFloat(player.getCurrentLiveLatency(), 10);
                const currentBuffer = player.getDashMetrics().getCurrentBufferLevel("video");
                history.averageLatency = latencyCMA.average(currentLatency);
                history.averageBufferLength = bufferCMA.average(currentBuffer);
                console.log(history);
            }, 200);


            player.on(dashjs.MediaPlayer.events.QUALITY_CHANGE_RENDERED, (e) => {
                recordSwitch(player.getBitrateInfoListFor('video')[e.newQuality]);
            });

            video.addEventListener('waiting', (e) => {
                stallingAt = performance.now();
            });

            video.addEventListener('timeupdate', () => {
                checkStallResolution();
            });

            function recordSwitch(quality) {
                if (!quality) {
                    return;
                }
                const switchHistory = history.switchHistory;
                const prev = switchHistory[switchHistory.length - 1];
                const videoNow = video.currentTime;
                if (prev) {
                    prev.end = videoNow;
                }
                switchHistory.push({ start: videoNow, end: null, quality });
            }

            function checkStallResolution() {
                if (stallingAt !== null) {
                    history.stallDuration += (performance.now() - stallingAt);
                    stallingAt = null;
                }
            }
        }
    });
</script>
<script src="../highlighter.js"></script>
</body>
</html>

Start denied to Schedule Controller

I'm facing nearly all the time this error:

[415][ScheduleController][video] Start denied to Schedule Controller

Sometimes streaming works. Any ideas?

Platform:

  • Manjaro
  • Own FFmpeg build

Network patterns for training solutions

I succeeded in setting up the test-bed and am working on my algorithm.
It would be helpful if you can provide me some network patterns for training my algorithm.
The current network patterns are quite simple and even some simple algorithms can perform very well already.

Thank you very much for your cooperation,

mpd not available on dash.js

Hi, I am using windows, according to the description, I compiled ffmpeg from scratch in the listed link, and installed dash.js. after running run_server.sh and run_gen.sh, I couldn't access the mpd file from dash.if player on the browser. Is there some issue with windows OS? or I should just switch to a linux system.

1581594481(1)

Using latest version of dash.js

Hi, @johnBartos , thank you for setting up an environment to study the low latency streaming.

Can I just replace the dash.js directory in this repo with the latest version to test the new functions of low latency dash? As you know, dash v3.2 has adoptted some great solutions of this challenge, and we want to test them with certain networks. You mentioned that the dash.js in this repo is modified, so I wound like to know is it okay to simply replace the dash.js directory, or some coordination is needed to incorporate the latest dash.js with the rest of this repo?

Thank you for your attention.

Lacking statistics in log

According to the challenge homepage, a proposed algorithm is evaluated using the following six criteria: Average selected bitrate (Mbps), Average buffer occupancy (s), Average live latency (s), Average number of bitrate switches, Average number of stalls, Average stall duration (s).

However, only the switch history, stallDuration, avgLatency, and avgBufferLength are provided in the log after running a test mode. Here is the result I got:

Run complete
{
  switchHistory: [
    { start: 8.821109, end: 9.978802, quality: [Object] },
    { start: 9.978802, end: 81.066866, quality: [Object] }
  ],
  stallDuration: 63883.05500005663,
  avgLatency: 12.028431111111123,
  avgBufferLength: 0.08518444444444441
}
Done

Could you please update the code so that I can get all the above six statistics to evaluate my algorithm?

Changing playback rate is allowed or not?

Is it allowed to slow down or speed up the playback rate to avoid a stall or reduce the latency, respectively? dash.js is capable of doing it, however, it is not clear whether this capability can be used or not.

Perform a test run failed on Ubuntu 16.04

I got the following error when performing a test with 'node run.js' command on Ubuntu 16.04, 64bit.
$ node run.js
Error: Failed to launch the browser process! spawn /Applications/Google Chrome.app/Contents/MacOS/Google Chrome ENOENT

It seems the path for Chrome is not correctly configured.
Please give me any suggestions to correct this error.
Thanks,
Nguyen

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.