Jump to content


Photo

Theater mpv test


  • Please log in to reply
3950 replies to this topic

#3181 Doofus ONLINE  

Doofus

    Advanced Member

  • Members
  • 11194 posts
  • Local time: 09:33 PM

Posted 31 August 2018 - 11:59 PM

Ok, I think I give up. This is as far as I've got. I get inconsistent results. I change something, it breaks. I undo the change, and it's still broken. There are too many layers for me to get through. I can't untangle this enough to get solid results. Here's a copy of the playbackandler with the changes I've made:

var processes = {};
var timeposition = 0;
var mainWindowRef
var mpv = require('node-mpv');
var mpvPlayer;
var playerWindowId;
var mpvPath;
var playMediaSource;
var playMediaType;
var playerStatus;
var fadeTimeout;
var currentVolume;
var currentPlayResolve;
var currentPlayReject;

function alert(text) {
    require('electron').dialog.showMessageBox(mainWindowRef, {
        message: text.toString(),
        buttons: ['ok']
    });
}

function play(player, path) {
    return new Promise(function (resolve, reject) {
        console.log('Play URL : ' + path);
        currentPlayResolve = resolve;
        currentPlayReject = reject;

        if (path.toLowerCase('http').indexOf() != -1) {
            //player.loadStream(path);
            player.loadFile(path);
        } else {
            player.loadFile(path);
        }
    });
}

function stop() {
    mpvPlayer.stop();
}

function pause() {
    mpvPlayer.pause();
}

function pause_toggle() {
    mpvPlayer.togglePause();
}

function unpause() {
    mpvPlayer.resume();
}

function set_position(data) {
    mpvPlayer.goToPosition(Math.round(data / 10000000));
}

function setAspectRatio(player, value) {

    switch (value) {
        case "4_3":
            player.setProperty("video-unscaled", "no");
            player.setProperty("video-aspect", "4:3");
            break;
        case "16_9":
            player.setProperty("video-unscaled", "no");
            player.setProperty("video-aspect", "16:9");
            break;
        case "bestfit":
            player.setProperty("video-unscaled", "no");
            player.setProperty("video-aspect", "-1");
            break;
        case "fill":
            //var size = player.getProperty("android-surface-size");
            //var aspect = parseFloat(size.split("x")[0]) / parseFloat(size.split("x")[1]);
            //player.setProperty("video-unscaled", "no");
            //player.setProperty("video-aspect", aspect);

            break;
        case "original":
            player.setProperty("video-unscaled", "downscale-big");
            player.setProperty("video-aspect", "-1");
            break;
    }
}

function set_volume(data) {
    mpvPlayer.volume(data);
}

function mute() {
    mpvPlayer.mute();
}

function unmute() {
    mpvPlayer.unmute();
}

function video_toggle() {
    var isRpi = require('detect-rpi');
    if (isRpi()) {
        mpvPlayer.cycleProperty("video");
    }
}

function set_audiostream(player, index) {

    var audioIndex = 0;
    var i, length, stream;
    var streams = playMediaSource.MediaStreams || [];
    for (i = 0, length = streams.length; i < length; i++) {
        stream = streams[i];
        if (stream.Type == 'Audio') {
            audioIndex++;
            if (stream.Index == index) {
                break;
            }
        }
    }
    player.setProperty("aid", audioIndex);
}

function set_subtitlestream(player, index) {

    if (index < 0) {
        player.setProperty("sid", "no");
    } else {
        var subIndex = 0;
        var i, length, stream;
        var streams = playMediaSource.MediaStreams || [];
        for (i = 0, length = streams.length; i < length; i++) {
            stream = streams[i];
            if (stream.Type == 'Subtitle') {
                subIndex++;

                if (stream.Index == index) {
                    if (stream.DeliveryMethod == 'External') {

                        player.addSubtitles(stream.DeliveryUrl, "cached", stream.DisplayTitle, stream.Language);
                    } else {
                        player.setProperty("sid", subIndex);
                    }

                    break;
                }
            }
        }
    }
}

function getMpvOptions(options, mediaType, mediaSource) {

    var list = [];

    var isRpi = require('detect-rpi');
    if (isRpi()) {
        list.push('--fs');
    }

    var audioOptions = getMpvAudioOptions(options, mediaType);
    for (var i = 0, length = audioOptions.length; i < length; i++) {
        list.push(audioOptions[i]);
    }

    var videoStream = (mediaSource.MediaStreams || []).filter(function (v) {
        return v.Type == 'Video';
    })[0];

    var framerate = videoStream ? (videoStream.AverageFrameRate || videoStream.RealFrameRate) : 0;

    var audioDelay = framerate >= 23 && framerate <= 25 ? options.audioDelay2325 : options.audioDelay;
    if (audioDelay) {
        list.push('mpv.conf');

    }

    if (mediaSource.RunTimeTicks == null) {
        list.push('mpv.conf');
    }

    return list;
}

function getMpvAudioOptions(options, mediaType) {

    var list = [];

    var audioChannels = options.audioChannels || 'auto-safe';
    var audioFilters = [];
    if (audioChannels === '5.1') {
        audioChannels = '5.1,stereo';
    }
    else if (audioChannels === '7.1') {
        audioChannels = '7.1,stereo';
    }

    var audioChannelsFilter = getAudioChannelsFilter(options, mediaType);
    if (audioChannelsFilter) {
        audioFilters.push(audioChannelsFilter);
    }

    if (audioFilters.length) {

        list.push('--af=lavfi=[' + (audioFilters.join(',')) + ']');
    }

    list.push('--audio-channels=' + (audioChannels));

    if (options.audioSpdif) {
        list.push('--audio-spdif=' + (options.audioSpdif));
    }

    list.push('mpv.conf');

    if (options.exclusiveAudio && mediaType === 'Video') {
        list.push('--audio-exclusive=yes');
    }

    return list;
}

function getAudioChannelsFilter(options, mediaType) {

    var enableFilter = false;
    var upmixFor = (options.upmixAudioFor || '').split(',');

    if (mediaType === 'Audio') {
        if (upmixFor.indexOf('music') !== -1) {
            enableFilter = true;
        }
    }

    //there's also a surround filter but haven't found good documentation to implement -PMR 20171225
    if (enableFilter) {
        var audioChannels = options.audioChannels || '';
        if (audioChannels === '5.1') {
            //return 'channels=6';
            return 'pan=5.1|FL=FL|BL=FL|FR=FR|BR=FR|FC<0.5*FL + 0.5*FR';
        }
        else if (audioChannels === '7.1') {
            //return 'channels=8';
            return 'pan=7.1|FL=FL|SL=FL|BL=FL|FR=FR|SR=FR|BR=FR|FC<0.5*FL + 0.5*FR';
        }
    }

    return '';
}

function fade(startingVolume) {
    var newVolume = Math.max(0, startingVolume - 0.15);
    set_volume(newVolume);

    if (newVolume <= 0) {
        return Promise.resolve();
    }

    return new Promise(function (resolve, reject) {

        cancelFadeTimeout();

        fadeTimeout = setTimeout(function () {
            fade(newVolume).then(resolve, reject);
        }, 1);
    });
}

function cancelFadeTimeout() {
    var timeout = fadeTimeout;
    if (timeout) {
        clearTimeout(timeout);
        fadeTimeout = null;
    }
}

function cleanup() {

    var player = mpvPlayer;

    player.removeAllListeners('timeposition');
    player.removeAllListeners('started');
    player.removeAllListeners('statuschange');
    player.removeAllListeners('stopped');

    try {
        player.quit();
    }
    catch (err) {
        console.log('error quitting mpv: ' + err);
    }

    delete mpvPlayer;

    mpvPlayer = null;
    playMediaSource = null;
    playMediaType = null;
    playerStatus = null;
}

function getReturnJson(positionTicks) {
    var playState = "playing";
    if (playerStatus.pause) {
        playState = "paused";
    }

    if (playerStatus['idle-active']) {
        playState = "idle";
    }

    var state = {
        isPaused: playerStatus.pause || false,
        isMuted: playerStatus.mute || false,
        volume: currentVolume || playerStatus.volume || 100,
        positionTicks: positionTicks || timeposition,
        playstate: playState,
        demuxerCacheState: playerStatus['demuxer-cache-state']
    }

    if (playerStatus.duration) {

        state.durationTicks = playerStatus.duration * 10000000;
    } else if (playerStatus['demuxer-cache-time']) {
        state.durationTicks = playerStatus['demuxer-cache-time'] * 10000000;
    }

    return Promise.resolve(JSON.stringify(state));
}

function getAudioStats(player) {

    var properties = [
        { property: 'audio-codec-name' },
        { property: 'audio-out-params' },
        { property: 'audio-bitrate', name: 'Audio bitrate:', type: 'bitrate' },
        { property: 'current-ao', name: 'Audio renderer:' },
        { property: 'audio-out-detected-device', name: 'Audio output device:' }
    ];

    var promises = properties.map(function (p) {
        return player.getProperty(p.property);
    });

    return Promise.all(promises).then(function (responses) {

        var stats = [];

        if (responses[0]) {
            stats.push({
                label: 'Audio codec:',
                value: responses[0]
            });
        }

        var audioParams = responses[1] || {};

        if (audioParams.channels) {
            stats.push({
                label: 'Audio channels:',
                value: audioParams.channels
            });
        }
        if (audioParams.samplerate) {
            stats.push({
                label: 'Audio sample rate:',
                value: audioParams.samplerate
            });
        }

        for (var i = 2, length = properties.length; i < length; i++) {

            var name = properties[i].name;

            var value = responses[i];

            if (properties[i].type == 'bitrate') {
                value = getDisplayBitrate(value);
            }

            if (value != null) {
                stats.push({
                    label: name,
                    value: value
                });
            }
        }
        return {
            stats: stats,
            type: 'audio'
        };
    });
}

function getDisplayBitrate(bitrate) {

    if (bitrate > 1000000) {
        return (bitrate / 1000000).toFixed(1) + ' Mbps';
    } else {
        return Math.floor(bitrate / 1000) + ' kbps';
    }
}

function getDroppedFrames(responses) {

    var html = '';

    html += (responses[responses.length - 4] || '0');

    html += ', Decoder dropped: ' + (responses[responses.length - 3] || '0');

    html += ', Mistimed: ' + (responses[responses.length - 2] || '0');

    html += ', Delayed: ' + (responses[responses.length - 1] || '0');

    return html;
}

function getVideoStats(player) {

    var properties = [
        { property: 'video-out-params' },
        { property: 'video-codec', name: 'Video codec:' },
        { property: 'video-bitrate', name: 'Video bitrate:', type: 'bitrate' },
        { property: 'current-vo', name: 'Video renderer:' },
        { property: 'hwdec-current', name: 'Hardware acceleration:' },
        { property: 'display-names', name: 'Display devices:' },
        { property: 'display-fps', name: 'Display fps:' },
        { property: 'estimated-display-fps', name: 'Estimated display fps:' },
        { property: 'display-sync-active', name: 'Display sync active:' },
        { property: 'frame-drop-count' },
        { property: 'decoder-frame-drop-count' },
        { property: 'mistimed-drop-count' },
        { property: 'vo-delayed-frame-count' }
    ];

    var promises = properties.map(function (p) {
        return player.getProperty(p.property);
    });

    return Promise.all(promises).then(function (responses) {

        var stats = [];

        var videoParams = responses[0] || {};

        for (var i = 1, length = properties.length - 4; i < length; i++) {

            var name = properties[i].name;

            var value = responses[i];

            if (properties[i].type == 'bitrate') {
                value = getDisplayBitrate(value);
            }

            if (value != null) {
                stats.push({
                    label: name,
                    value: value
                });
            }
        }

        stats.push({
            label: 'Dropped frames:',
            value: getDroppedFrames(responses)
        });

        var winPosition = mainWindowRef.getPosition();
        var displayParams = require('electron').screen.getDisplayNearestPoint({ x: winPosition[0], y: winPosition[1] })

        stats.push({
            label: 'Display Fullscreen Resolution:',
            value: displayParams.size.width + ' x ' + displayParams.size.height
        });

        if (videoParams.w && videoParams.h) {
            stats.push({
                label: 'Video resolution:',
                value: videoParams.w + ' x ' + videoParams.h
            });
        }

        if (videoParams.aspect) {
            stats.push({
                label: 'Aspect ratio:',
                value: videoParams.aspect
            });
        }

        if (videoParams.pixelformat) {
            stats.push({
                label: 'Pixel format:',
                value: videoParams.pixelformat
            });
        }

        if (videoParams.colormatrix) {
            stats.push({
                label: 'Color matrix:',
                value: videoParams.colormatrix
            });
        }

        if (videoParams.primaries) {
            stats.push({
                label: 'Primaries:',
                value: videoParams.primaries
            });
        }

        if (videoParams.gamma) {
            stats.push({
                label: 'Gamma:',
                value: videoParams.gamma
            });
        }

        if (videoParams.colorlevels) {
            stats.push({
                label: 'Levels:',
                value: videoParams.colorlevels
            });
        }

        return {
            stats: stats,
            type: 'video'
        };
    });
}

function getMediaStats(player) {

    var properties = [
        { property: 'media-title', name: 'Title:' },
        { property: 'chapter', name: 'Chapter:' }
    ];

    var promises = properties.map(function (p) {
        return player.getProperty(p.property);
    });

    return Promise.all(promises).then(function (responses) {

        var stats = [];

        for (var i = 0, length = properties.length; i < length; i++) {

            var name = properties[i].name;

            var value = responses[i];

            if (value != null) {
                stats.push({
                    label: name,
                    value: value
                });
            }
        }
        return {
            stats: stats,
            type: 'media'
        };
    });
}

function getStatsJson(player) {

    return Promise.all([getMediaStats(player), getVideoStats(player), getAudioStats(player)]).then(function (responses) {

        var categories = [];

        for (var i = 0, length = responses.length; i < length; i++) {
            categories.push(responses[i]);
        }

        return JSON.stringify({
            categories: categories
        });
    });
}

function processRequest(request, body) {
    return new Promise(function (resolve, reject) {
        var url = require('url');
        var url_parts = url.parse(request.url, true);
        var action = url_parts.pathname.substring(1).toLowerCase();

        switch (action) {

            case 'play':
                var data = JSON.parse(body);
                playMediaSource = data.mediaSource;
                createMpv(data.playerOptions, data.mediaType, playMediaSource);
                playMediaType = data.mediaType;

                var startPositionTicks = data["startPositionTicks"];

                mpvPlayer.volume(data.playerOptions.volume || 100);

                play(mpvPlayer, data.path).then(() => {
                    if (playMediaSource.DefaultAudioStreamIndex != null && data.playMethod != 'Transcode') {
                        set_audiostream(mpvPlayer, playMediaSource.DefaultAudioStreamIndex);
                    }

                    if (playMediaSource.DefaultSubtitleStreamIndex != null) {
                        set_subtitlestream(mpvPlayer, playMediaSource.DefaultSubtitleStreamIndex);
                    }
                    else {
                        set_subtitlestream(mpvPlayer, -1);
                    }

                    if (startPositionTicks != 0) {
                        set_position(startPositionTicks);
                    }

                    getReturnJson(startPositionTicks).then(resolve);
                }).catch(reject);

                break;
            case 'stats':
                if (mpvPlayer) {
                    getStatsJson(mpvPlayer).then(resolve);
                } else {
                    resolve('[]');
                }
                break;
            case 'stop':
                stop();
                getReturnJson().then(resolve);
                break;
            case 'stopdestroy':

                getReturnJson().then(function (returnJson) {
                    if (playMediaType.toLowerCase() === 'audio') {
                        currentVolume = playerStatus.volume || 100;
                        fade(currentVolume).then(() => {
                            stop();
                            set_volume(currentVolume);
                            currentVolume = null;
                            cleanup();
                        }).catch(reject);
                    } else {
                        stop();
                        cleanup();
                    }

                    resolve(returnJson);
                });

                break;
            case 'positionticks':
                var data = url_parts.query["val"];
                set_position(data);
                timeposition = data;
                getReturnJson().then(resolve);
                break;
            case 'seekrelative':
                var data = url_parts.query["val"];
                mpvPlayer.seek(Math.round(data / 10000000));
                //timeposition = (timeposition || 0) + data;
                getReturnJson().then(resolve);
                break;
            case 'unpause':
                unpause();
                getReturnJson().then(resolve);
                break;
            case 'playpause':
                pause_toggle();
                getReturnJson().then(resolve);
                break;
            case 'pause':
                pause();
                getReturnJson().then(resolve);
                break;
            case 'volumeup':
                set_volume(Math.min(100, (currentVolume || playerStatus.volume || 100) + 2));
                getReturnJson().then(resolve);
                break;
            case 'volumedown':
                set_volume(Math.max(0, (currentVolume || playerStatus.volume || 100) - 2));
                getReturnJson().then(resolve);
                break;
            case 'volume':
                var data = url_parts.query["val"];
                set_volume(data);
                getReturnJson().then(resolve);
                break;
            case 'aspectratio':
                var data = url_parts.query["val"];
                setAspectRatio(mpvPlayer, data);
                getReturnJson().then(resolve);
                break;
            case 'mute':
                mute();
                getReturnJson().then(resolve);
                break;
            case 'unmute':
                unmute();
                getReturnJson().then(resolve);
                break;
            case 'setaudiostreamindex':
                var data = url_parts.query["index"];
                set_audiostream(mpvPlayer, data);
                getReturnJson().then(resolve);
                break;
            case 'setsubtitlestreamindex':
                var data = url_parts.query["index"];
                set_subtitlestream(mpvPlayer, data);
                getReturnJson().then(resolve);
                break;
            case 'video_toggle':
                video_toggle();
                getReturnJson().then(resolve);
                break;
            default:
                // This could be a refresh, e.g. player polling for data
                getReturnJson().then(resolve);
                break;
        }
    });
}

function initialize(playerWindowIdString, mpvBinaryPath) {
    playerWindowId = playerWindowIdString;
    mpvPath = mpvBinaryPath;
}

function onMpvTimePosition(data) {
    timeposition = data * 10000000;
}

function onMpvStarted() {
    var resolve = currentPlayResolve;
    if (resolve) {
        currentPlayResolve = null;
        currentPlayReject = null;
        resolve();
    }
    mainWindowRef.focus();
}

function onMpvStatusChange(status) {
    playerStatus = status;
}

function onMpvStopped() {
    timeposition = 0;
}

function onMpvError() {
    onMpvStopped();
    cleanup();
}

function createMpv(options, mediaType, mediaSource) {
    if (mpvPlayer) return;
    var isWindows = require('is-windows');

    var mpvOptions = getMpvOptions(options, mediaType, mediaSource);

    mpvOptions.push('--wid=' + playerWindowId);
    mpvOptions.push('--no-osc');

    var mpvInitOptions = {
        "debug": false
    };

    if (mpvPath) {
        mpvInitOptions.binary = mpvPath;
    }

    if (isWindows()) {

        mpvInitOptions.socket = "\\\\.\\pipe\\emby-pipe";
        mpvInitOptions.ipc_command = "--input-ipc-server";
    } else {

        mpvInitOptions.socket = "/tmp/emby.sock";
        mpvInitOptions.ipc_command = "--input-unix-socket";
    }

    mpvPlayer = new mpv(mpvInitOptions, mpvOptions);

    mpvPlayer.observeProperty('idle-active', 13);
    mpvPlayer.observeProperty('demuxer-cache-time', 14);
    mpvPlayer.observeProperty('demuxer-cache-state', 15);

    mpvPlayer.on('timeposition', onMpvTimePosition);
    mpvPlayer.on('started', onMpvStarted);
    mpvPlayer.on('statuschange', onMpvStatusChange);
    mpvPlayer.on('stopped', onMpvStopped);
    mpvPlayer.on('error', onMpvError);
}

function processNodeRequest(req, res) {

    var body = [];

    req.on('data', function (chunk) {
        body.push(chunk);
    }).on('end', function () {

        body = Buffer.concat(body).toString();
        // at this point, `body` has the entire request body stored in it as a string

        processRequest(req, body).then((json) => {
            if (json != null) {
                res.writeHead(200, { 'Content-Type': 'application/json' });
                res.end(json);
            } else {
                res.writeHead(500);
                res.end();
            }
        }).catch(() => {
            res.writeHead(500);
            res.end();
        });
    });
}

function registerMediaPlayerProtocol(protocol, mainWindow) {

    mainWindowRef = mainWindow;

    var http = require('http');

    http.createServer(processNodeRequest).listen(8023, '127.0.0.1');
}

exports.initialize = initialize;
exports.registerMediaPlayerProtocol = registerMediaPlayerProtocol;



#3182 pclausen OFFLINE  

pclausen

    Advanced Member

  • Members
  • 373 posts
  • Local time: 12:33 AM

Posted 03 September 2018 - 06:23 PM

I'm back to using ET as my primary playback device since the Shield does not properly color map 4k UHD HDR titles to my 4k non-HDR TV. (some do map properly, but most don't)

 

I had to make the desktop black and move the taskbar to the top in order to get rid of the 3 pixel bar at the bottom and on the right side.  Anyway, with those changes, 4k HDR titles play back nice and smooth and with no dropped frames and audio tracks bitstreaming to my receiver for decoding.  Ditto for regular Blu-Ray titles and DVD.

 

But I was wondering, with all those video playback setting configurations within, what would be a good starting point to deal with poor sources like new release movie cams?

 

I'm running the latest Win 10, and have a Nvidia 1050Ti GPU.  But I also have other Nvidia cards available, including 1080Ti's (I mine crypto), so if one of those cards, with "everything turned on" would somehow make those crappy cams look better (especially dark scenes), I'd be very interested in giving that a shot.  I used to run madvr "back in the day", but since getting the Shield a few years ago, that is all but a memory at this point.  :)



#3183 Doofus ONLINE  

Doofus

    Advanced Member

  • Members
  • 11194 posts
  • Local time: 09:33 PM

Posted 03 September 2018 - 06:41 PM

I'm back to using ET as my primary playback device since the Shield does not properly color map 4k UHD HDR titles to my 4k non-HDR TV. (some do map properly, but most don't)

 

I had to make the desktop black and move the taskbar to the top in order to get rid of the 3 pixel bar at the bottom and on the right side.  Anyway, with those changes, 4k HDR titles play back nice and smooth and with no dropped frames and audio tracks bitstreaming to my receiver for decoding.  Ditto for regular Blu-Ray titles and DVD.

 

But I was wondering, with all those video playback setting configurations within, what would be a good starting point to deal with poor sources like new release movie cams?

 

I'm running the latest Win 10, and have a Nvidia 1050Ti GPU.  But I also have other Nvidia cards available, including 1080Ti's (I mine crypto), so if one of those cards, with "everything turned on" would somehow make those crappy cams look better (especially dark scenes), I'd be very interested in giving that a shot.  I used to run madvr "back in the day", but since getting the Shield a few years ago, that is all but a memory at this point.  :)

 

That's going to depend on what you want to adjust/correct. Is it just color correction? Different decoders will use different interfaces, and yield different results. Those options are largely, global. So it can be a bit delicate. 


Edited by Doofus, 14 September 2018 - 11:43 PM.


#3184 pclausen OFFLINE  

pclausen

    Advanced Member

  • Members
  • 373 posts
  • Local time: 12:33 AM

Posted 04 September 2018 - 06:14 AM

I was thinking of having 2 separate ET installs on my HTPC, or some other way to switch "playback profiles".

 

One for good source material, and one for poor source material that requires a lot of processing to look decent on a large 4k display.

 

I'll see if I can get Electron going as a stand alone player and fiddle with the playback options on some of my poor source material.  I basically would like to increase brightness, and upscale low resolution to 4k to the extent that a 1080Ti is capable of doing so.



#3185 daedalus OFFLINE  

daedalus

    Advanced Member

  • Members
  • 926 posts
  • Local time: 06:33 AM

Posted 04 September 2018 - 09:17 AM

I was thinking of having 2 separate ET installs on my HTPC, or some other way to switch "playback profiles".

 

One for good source material, and one for poor source material that requires a lot of processing to look decent on a large 4k display.

 

mpv can get extended to have profiles loaded based on various properties -> https://github.com/w...to-profiles.lua



#3186 Doofus ONLINE  

Doofus

    Advanced Member

  • Members
  • 11194 posts
  • Local time: 09:33 PM

Posted 04 September 2018 - 12:34 PM

mpv can get extended to have profiles loaded based on various properties -> https://github.com/w...to-profiles.lua


How well does that work with theater? Some of the filters I use interfere with decoding some of my videos in Theater. Mainly 4k HDR stuff. I suppose you could use a profile that ignores HDR content?

#3187 daedalus OFFLINE  

daedalus

    Advanced Member

  • Members
  • 926 posts
  • Local time: 06:33 AM

Posted 04 September 2018 - 01:15 PM

basically with that script every property condition could have its own "independent mpv.conf" inside your mpv.conf

 

unfortunately you have to dig out what exact property to recognize HDR by yourself (https://mpv.io/manua...ter/#properties), i use this just for some little settings



#3188 Doofus ONLINE  

Doofus

    Advanced Member

  • Members
  • 11194 posts
  • Local time: 09:33 PM

Posted 05 September 2018 - 01:00 AM

basically with that script every property condition could have its own "independent mpv.conf" inside your mpv.conf

 

unfortunately you have to dig out what exact property to recognize HDR by yourself (https://mpv.io/manua...ter/#properties), i use this just for some little settings

 

I've tried getting that to work for deinterlacing, in the past. But it doesn't work.



#3189 Doofus ONLINE  

Doofus

    Advanced Member

  • Members
  • 11194 posts
  • Local time: 09:33 PM

Posted 05 September 2018 - 01:54 PM

You know, I can probably make a profile just based on resolution. That should isolate the HDR stuff. That should work, right?

https://mpv.io/manua...nterface-height

Edited by Doofus, 05 September 2018 - 02:04 PM.


#3190 Doofus ONLINE  

Doofus

    Advanced Member

  • Members
  • 11194 posts
  • Local time: 09:33 PM

Posted 05 September 2018 - 06:49 PM

Better still, I'm just gonna make a profile for HEVC. That's a bigger and better net to cast.

#3191 Luke OFFLINE  

Luke

    System Architect

  • Administrators
  • 126752 posts
  • Local time: 12:33 AM

Posted 05 September 2018 - 11:52 PM

Electron 2.08 still holding up well? I suppose i could cut a new release with that. Have you played with any of the recent 3.0 betas?



#3192 Doofus ONLINE  

Doofus

    Advanced Member

  • Members
  • 11194 posts
  • Local time: 09:33 PM

Posted 06 September 2018 - 12:35 AM

Electron 2.08 still holding up well? I suppose i could cut a new release with that. Have you played with any of the recent 3.0 betas?

 

2.0.8 has been great. I haven't tried 3.0 since beta3. That gave me a black screen. I figured you needed to look at the breaking changes?



#3193 Luke OFFLINE  

Luke

    System Architect

  • Administrators
  • 126752 posts
  • Local time: 12:33 AM

Posted 06 September 2018 - 12:42 AM

Ah yes that's right, thanks.



#3194 Luke OFFLINE  

Luke

    System Architect

  • Administrators
  • 126752 posts
  • Local time: 12:33 AM

Posted 09 September 2018 - 09:08 AM

3.0.3 for Raspberry Pi now available with HDMI-CEC fixes:

 

https://emby.media/c...ater-for-linux/

 

Thanks everyone.



#3195 Doofus ONLINE  

Doofus

    Advanced Member

  • Members
  • 11194 posts
  • Local time: 09:33 PM

Posted 09 September 2018 - 10:16 PM

I finally made a profile for interlaced content. Deinterlacing will only be used when interlaced content is detected.

[Interlaced]
profile-desc=cond:p["video-frame-info/interlaced"]
vf=lavfi=yadif

or

[Interlaced]
profile-desc=cond:p["video-frame-info/interlaced"]
deinterlace=yes 

This way, it isn't used when I play other content, and doesn't cause problems (dropped frames etc).

 

And of course you'll need the auto-profiles script (attached). Delete .txt

Attached Files


Edited by Doofus, 14 November 2018 - 12:02 AM.


#3196 Doofus ONLINE  

Doofus

    Advanced Member

  • Members
  • 11194 posts
  • Local time: 09:33 PM

Posted 09 September 2018 - 10:46 PM

I don't know what's going on with Theater, but something screwy happens in fullscreen. Sometimes the settings work, sometimes they don't. I can't test, consistently. When windowed, it's much better. There are some big problems with fullscreen. I don't have this problem in the standalone.

 

 

I think I know what's happening. Theater isn't using it as a profile. It's applying yadif, generally. That's why it's screwing with the decoder.


Edited by Doofus, 09 September 2018 - 11:36 PM.


#3197 Doofus ONLINE  

Doofus

    Advanced Member

  • Members
  • 11194 posts
  • Local time: 09:33 PM

Posted 10 September 2018 - 12:45 AM

Ok, I think I may have figured this out. The profile needs to be the very last entry in the mpv.conf, as everything below it will be included in that profile. And it would appear that even a blank line will interfere with it. Through testing I left in some blank lines, below it. Removing them seems to have stabilized it's function, and playback of 4k HDR isn't dropping frames, and is finally decoding correctly when in full screen. I will keep testing, but it's looking good :)


Edited by Doofus, 10 September 2018 - 01:02 AM.

  • PrincessClevage likes this

#3198 denz OFFLINE  

denz

    Advanced Member

  • Members
  • 2006 posts
  • Local time: 12:33 PM
  • LocationPerth, Australia

Posted 10 September 2018 - 03:37 AM

@Doofus I tested it and it is not working it is always using yadif for both progressive and interlaced content. 

 

I can see that auto-profile is loaded 

 

[   0.010][v][auto_profiles] Re-evaluate auto profile Interlaced
[   0.010][e][auto_profiles] Profile 'Interlaced' did not return a Boolean.


  • Doofus likes this

#3199 Doofus ONLINE  

Doofus

    Advanced Member

  • Members
  • 11194 posts
  • Local time: 09:33 PM

Posted 10 September 2018 - 10:23 AM

@Doofus I tested it and it is not working it is always using yadif for both progressive and interlaced content.

I can see that auto-profile is loaded

[ 0.010][v][auto_profiles] Re-evaluate auto profile Interlaced
[ 0.010][e][auto_profiles] Profile 'Interlaced' did not return a Boolean.

Ignore that, it always shows that. Post your MPV.conf

How are you determining that it's always on?

Edited by Doofus, 10 September 2018 - 01:51 PM.


#3200 daedalus OFFLINE  

daedalus

    Advanced Member

  • Members
  • 926 posts
  • Local time: 06:33 AM

Posted 10 September 2018 - 02:27 PM

Ok, I think I may have figured this out. The profile needs to be the very last entry in the mpv.conf, as everything below it will be included in that profile. And it would appear that even a blank line will interfere with it. Through testing I left in some blank lines, below it. Removing them seems to have stabilized it's function, and playback of 4k HDR isn't dropping frames, and is finally decoding correctly when in full screen. I will keep testing, but it's looking good :)

 

profiles should always be last, and to have a "closing point" simply add an "empty" profile at the last line of your mpv.conf, i have added eg

[default]

  • Doofus likes this




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users