SOLVED - Since 0.10.26 the MODded videos do not play when Reshade is activated

Discuss modding questions and implementation details.
User avatar
pango
Posts: 3347
Joined: Wed Jul 18, 2018 6:14 pm
Location: France
Contact:

Re: SOLVED - Since 0.10.26 the MODded videos do not play when Reshade is activated

Post by pango »

You can read the gory details about supported formats and codecs by platform here: https://docs.unity3d.com/Manual/VideoSo ... ility.html

Code that picks what file extension to use for each platform is at the top of VideoReplacement.cs

From the look of the script I used for webm encoding, I chose 6Mbps target for video, and didn't spent more time tweaking parameters:

Code: Select all

ffmpeg -i "$file" -c:v libvpx -c:a libvorbis -b:v 6M "webm/${filename^^*}.webm"
That's significantly lower bitrate than the source (30MB for 2 minutes 1280x720 seemed a bit excessive), so comparing outputs is not really fair.

Also, there will always be some quality loss with each reencoding, so to compare formats you should really start from the unencoded original, which you may not have anymore...
And given the very low quality videos this all started from, most details have been "invented" by algorithms, so I think we should look for result that looks good, rather than exactly preserve all the details of the unencoded video; It won't be less faithful to the original low res videos.
Mastodon: @pango@fosstodon.org
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

User avatar
King of Worms
Posts: 4752
Joined: Mon Oct 17, 2016 11:18 pm
Location: Scourg Barrow (CZ)
Contact:

Re: SOLVED - Since 0.10.26 the MODded videos do not play when Reshade is activated

Post by King of Worms »

Thats misunderstanding mate :)

I dont compare the videos you converted so the linux uses can see them (I appreciate you did that and I thank you for that)

I compare the videos I have on my PC. They are in mp4. I Double click em on windows, they play, look nice.
If I want em ingame, I need to open unity, and select - transcode to VP8. Than I create DFMOD, start DFU, see the video and I want to die ....

So thats a fair comparison.

I also made a new intro. Its CLEAN. Than I used VP8, and I want to die again :D

Thats why I asked for what I asked for. Just mere OPTION to use other formats than mp4 for the hope they will actually work better than this VP8 cr*p (sry but I had to say it) - Im stuck with VP8 here because mp4 does not work with reshade since we upgraded to 2019lts. And I look for ANY possibility to solve this situation, thats all. All I want is the vids to not be compromised by this step I need to do since upgrade.

User avatar
pango
Posts: 3347
Joined: Wed Jul 18, 2018 6:14 pm
Location: France
Contact:

Re: SOLVED - Since 0.10.26 the MODded videos do not play when Reshade is activated

Post by pango »

King of Worms wrote: Sat Dec 12, 2020 1:56 pm I dont compare the videos you converted so the linux uses can see them (I appreciate you did that and I thank you for that)
Okay!
King of Worms wrote: Sat Dec 12, 2020 1:56 pm I compare the videos I have on my PC. They are in mp4. I Double click em on windows, they play, look nice.
If I want em ingame, I need to open unity, and select - transcode to VP8. Than I create DFMOD, start DFU, see the video and I want to die ....

So thats a fair comparison.
That's still not fair for at least two reasons. First you had a transcoding (mp4 videos have to be decoded to be re-encoded in another codec). From what I'm reading, including independant reviews, VP8 can be very close to H264 video quality (which is what DAG2.mp4 uses, mp4 is the format not the video codec). Unity's VideoClip Importer seems to have very few parameters, but have you tried the highest settings?
If you did, and still get crappy results, I'd question VideoClip Importer quality,
[P.S. From horse's mouth: "Note that our internal conversion to VP8 doesn't do the best possible job quality-wise. So if you want to keep this option, I suggest transcoding to webm/vp8 using an external tool (ffmpeg) that gives you the full control over this."]

And secondly you don't use the same player. It's very likely that your usual player does postprocessing, be it just color adjustments, dithering, whatever, that the Unity embedded player may or may not do.
King of Worms wrote: Sat Dec 12, 2020 1:56 pm I also made a new intro. Its CLEAN. Than I used VP8, and I want to die again :D
If you created VP8 directly from video source, again I'd check encoding parameters, because the codec itself should very close to H264 capabilities.
King of Worms wrote: Sat Dec 12, 2020 1:56 pm Thats why I asked for what I asked for. Just mere OPTION to use other formats than mp4 for the hope they will actually work better than this VP8 cr*p (sry but I had to say it) - Im stuck with VP8 here because mp4 does not work with reshade since we upgraded to 2019lts. And I look for ANY possibility to solve this situation, thats all. All I want is the vids to not be compromised by this step I need to do since upgrade.
You're confusing format and codec, which is interesting in itself because I don't know whether it's the format or the codec that causes the incompatibility with Reshade.
I suspect that the problem with H264 is that your video card having hardware acceleration for that format, it's not rendered thru DirectX or OpenGL, but thru dedicated video rendering pipeline (VDPAU for Nvidia, but other constructors probably have similar things) and could be incompatible with Reshade. If that hypothesis is right then it should be codec dependent, even if it's not really codecs' fault.

All I did to switch from mp4 to webm on Linux... Is to change the expected video files extension.
It may have been purely "cosmetic", many players only rely on content to determine the format, since it's usually more reliable (beside filename mangling, if you're reading a stream for example, there may not be any filename to rely on).
For convenience I could modify VideoReplacement to try a list of extensions; But I suspect you can already experiment with different formats and codecs as long as the video filename is DAG2.mp4...
Last edited by pango on Sat Dec 12, 2020 5:10 pm, edited 1 time in total.
Mastodon: @pango@fosstodon.org
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

User avatar
pango
Posts: 3347
Joined: Wed Jul 18, 2018 6:14 pm
Location: France
Contact:

Re: SOLVED - Since 0.10.26 the MODded videos do not play when Reshade is activated

Post by pango »

Actually, trying to modify the code I noticed that in the case of videos taken from mods, VideoReplacement does not use videoExtension, just the filename without extenson...
My change only impacted the loading of loose files, I'm not sure what happens for mods... I assume that inside mods, video file extension already doesn't matter.
Mastodon: @pango@fosstodon.org
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

User avatar
King of Worms
Posts: 4752
Joined: Mon Oct 17, 2016 11:18 pm
Location: Scourg Barrow (CZ)
Contact:

Re: SOLVED - Since 0.10.26 the MODded videos do not play when Reshade is activated

Post by King of Worms »

Im almost certain its the Unity transcoding which does a bad job so thats a agreement. I indeed use high quality preset there.

Thing is If I transcode the mp4 to VPx using the external utility than it creates the webm extension. If I rename that to mp4 and place in movies, it tries to load that vid but it gets stuck ingame, same as if I place there the original mp4 file. Feels like as soon as there is mp4 extension it just sends everything to hell no matter the codec inside it or anything.

Ive tried changing the codec inside the mp4 container to everything possible and it did not work as well.

If I place the mp4 file to movies, rename the extension to webm it does not play the video ingame. It plays the vanila vid.

So Im just lost
Still some useful info here, thanks a lot Pango!

This is the options I have, Im gonna try all... export, rename to mp4, place to "movies"... nothing much more to try IMO?
01.jpg
01.jpg (70.75 KiB) Viewed 1356 times

User avatar
pango
Posts: 3347
Joined: Wed Jul 18, 2018 6:14 pm
Location: France
Contact:

Re: SOLVED - Since 0.10.26 the MODded videos do not play when Reshade is activated

Post by pango »

King of Worms wrote: Sat Dec 12, 2020 5:36 pm Ive tried changing the codec inside the mp4 container to everything possible and it did not work as well.

If I place the mp4 file to movies, rename the extension to webm it does not play the video ingame. It plays the vanila vid.
It's not too difficult to make DFU try several extensions for loose files (an even look for filenames with extension into mods, if that makes sense; at least iit seems to work fine):
https://github.com/Interkarma/daggerfal ... extensions

However since it's purely an experiment need at this point, I'm not sure it's fine to merge it into DFU master branch.
If you know how to recompile DFU with patches, you can try this change; Otherwise I think I could recompile it for Windows and upload it somewhere...
Mastodon: @pango@fosstodon.org
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

User avatar
King of Worms
Posts: 4752
Joined: Mon Oct 17, 2016 11:18 pm
Location: Scourg Barrow (CZ)
Contact:

Re: SOLVED - Since 0.10.26 the MODded videos do not play when Reshade is activated

Post by King of Worms »

Never recompiled, I cant even run DFU from the Unity editor :oops:
IF you could do that, it would be great. In the meantime Im going thru the various codecs from that screenshot Ive posted, but no change so far. Thanks a lot, and no rush, when its done, its done :)

EDIT: Tried all options and some more (VP8 convert online) and still same result - as soon as its called MP4, the video freezes and bugs out the whole game

User avatar
TheLacus
Posts: 1305
Joined: Wed Sep 14, 2016 6:22 pm

Re: SOLVED - Since 0.10.26 the MODded videos do not play when Reshade is activated

Post by TheLacus »

pango wrote: Sat Dec 12, 2020 6:14 pm
King of Worms wrote: Sat Dec 12, 2020 5:36 pm Ive tried changing the codec inside the mp4 container to everything possible and it did not work as well.

If I place the mp4 file to movies, rename the extension to webm it does not play the video ingame. It plays the vanila vid.
It's not too difficult to make DFU try several extensions for loose files (an even look for filenames with extension into mods, if that makes sense; at least iit seems to work fine):
https://github.com/Interkarma/daggerfal ... extensions

However since it's purely an experiment need at this point, I'm not sure it's fine to merge it into DFU master branch.
If you know how to recompile DFU with patches, you can try this change; Otherwise I think I could recompile it for Windows and upload it somewhere...
Note that it breaks load order for mods, so i'd suggests against that. Current approach should already work with any extension.

It also breaks loose files order handled by mod managers, but you're more focused on the issue here so i'll leave to you to decide if is worth it.

User avatar
pango
Posts: 3347
Joined: Wed Jul 18, 2018 6:14 pm
Location: France
Contact:

Re: SOLVED - Since 0.10.26 the MODded videos do not play when Reshade is activated

Post by pango »

Got it, so I'll leave loading from mods untouched.
Mastodon: @pango@fosstodon.org
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

User avatar
pango
Posts: 3347
Joined: Wed Jul 18, 2018 6:14 pm
Location: France
Contact:

Re: SOLVED - Since 0.10.26 the MODded videos do not play when Reshade is activated

Post by pango »

Windows x86_64 build with this patch: http://ks369561.kimsufi.com/~petchema/g ... nsions.zip
It supports .mp4 and .webm loose video files. Loading from mods shouldn't care about the extension used.

New webm's I tested it with: http://ks369561.kimsufi.com/~petchema/g ... l/webm.zip
(nothing special, 2-pass compressed using

Code: Select all

    ffmpeg  -i "$file" -c:v libvpx -c:a libvorbis -b:v 0  -crf 20  -pass 1  -an -f webm /dev/null -y
    ffmpeg  -i "$file" -c:v libvpx -c:a libvorbis -b:v 0  -crf 20  -pass 2  "webm/${filename^^*}.webm" -y
-crf 20 gives about the same bitrate as original mp4s)
Mastodon: @pango@fosstodon.org
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

Post Reply