ekisu / mpv-webm

Simple WebM maker for mpv, with no external dependencies.
MIT License
556 stars 33 forks source link

Playback issues caused by High@L6.2 format #70

Closed FlappyFalcon closed 4 years ago

FlappyFalcon commented 4 years ago

Whenever I encode using the plugin, the format of the video is always 'High@L6.2' when I look in mediainfo. The problem is that apparently this causes playback issues when the video is uploaded to some sites. However the format High@L3 plays fine for others.

Is there a way to change something in the settings to make it output the format as ' High@L3'?

FlappyFalcon commented 4 years ago

To expand on this a bit. Basically the h.264 level, High@L6.2', that this plugin outputs at has playback problems on other people's devices. I'm not sure where in the script I can edit to change the format to be a lower level like L3

ekisu commented 4 years ago

You could add --ovcopts-add=profile=high --ovcopts-add=level=3 to either the additional_flags on options, or something like the following getFlags function into src/formats/mp4.moon (of course this would require recompiling the script, you could add it directly into the Lua compiled file as well):

class MP4 extends Format
    new: =>
        @displayName = "MP4 (h264/AAC)"
        @supportsTwopass = true
        @videoCodec = "libx264"
        @audioCodec = "aac"
        @outputExtension = "mp4"
        @acceptsBitrate = true

    getFlags: =>
        {
            "--ovcopts-add=profile=high",
                        "--ovcopts-add=level=3"
        }

I intend to add codec-specific options soon™.

FlappyFalcon commented 4 years ago

Thanks, that worked. Also one more thing, is there any reason why nvenc doesn't work? Well for me at least. It keeps saying failed and check the log. But I'm not sure where logs outputted on Windows, they don't come in my mpv folder.

ekisu commented 4 years ago

Welp, no idea, I don't have a NVidia card. Logs are outputted in the same dir of the currently playing video, if you have log-file=log.txt in your mpv.conf.

FlappyFalcon commented 4 years ago

Oh that's how you make them. It got generated log.txt . Not sure why it ain't working.

ekisu commented 4 years ago

The relevant part is this:

[  20.177][v][webm] [autoconvert] Converting yuv420p10 -> yuv420p
[  20.177][v][webm] VO: [lavc] 854x480 yuv420p
[  20.177][v][webm] [vo/lavc] AVOption 'crf' not found.
[  20.177][v][webm] [vo/lavc] Opening encoder: NVIDIA NVENC H.264 encoder [h264_nvenc]
[  20.177][v][webm] [ffmpeg] h264_nvenc: InitializeEncoder failed: invalid param (8): Invalid Level.
[  20.177][v][webm] [vo/lavc] Could not initialize encoder.
[  20.177][v][webm] Could not initialize video chain.
[  20.177][v][webm] Video: no video

I'd guess NVENC doesn't support encoding at level 3, but I don't know - sometimes passing parameters to the encoders is a bit wonky with mpv. Does using ffmpeg with NVENC, using -profile high and -level 3, works?

FlappyFalcon commented 4 years ago

Before I set it to level 3 it wasn't working before either so I don't think it's that (meaning it wasn't working on 6.2). And I'm not sure where I should put -profile high in the script under nvenc.

ekisu commented 4 years ago

I mean, using those flags with ffmpeg - testing whether it's a bug with NVENC (if ffmpeg also fails) or with mpv. For example:

ffmpeg -i input.mp4 -c:v h264_nvenc -profile high -level 3 -preset default output.mp4
FlappyFalcon commented 4 years ago

Oh okay I tried that and put it in ffmpeg and it worked

ekisu commented 4 years ago

So it seems to be a mpv bug. I would recommend opening an issue on their repo, there isn't much I can do about this.

FlappyFalcon commented 4 years ago

Ah okay, thanks for your help though

FlappyFalcon commented 4 years ago

Well I removed -ovcopts-add=profile=high --ovcopts-add=level=3 from additional flags and nvenc encoded it. Strange, as it's been shown that it can encode at level 3 with ffmpeg. One issue though is that it keeps changing the fps to 29 (30) from native 24 that anime is normally at