-
Notifications
You must be signed in to change notification settings - Fork 2.9k
FFmpeg Win64: Introduce optional shared DLL method #7110
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
Conversation
| #if defined(_WIN32) | ||
| if (FFmpeg_Win32_Exists() == true) | ||
| { | ||
| auto* dump_frames = movie_menu->addAction(tr("Dump Frames")); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Source/Core/Common/CommonPaths.h
Outdated
| // Directory separators, do we need this? | ||
| #define DIR_SEP "/" | ||
| #define DIR_SEP_CHR '/' | ||
| #define DIR_SEP_WIN32 "\\" |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
|
Could you branch out the External changes into a different commit? |
Source/Core/DolphinQt2/MenuBar.cpp
Outdated
| #include "UICommon/GameFile.h" | ||
|
|
||
| #if defined(_WIN32) | ||
| bool FFmpeg_Win32_Exists() |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Source/Core/DolphinQt2/MenuBar.cpp
Outdated
| const std::string swresample = File::GetExeDirectory() + DIR_SEP_WIN32 + "swresample-3.dll"; | ||
| const std::string swscale = File::GetExeDirectory() + DIR_SEP_WIN32 + "swscale-5.dll"; | ||
|
|
||
| if (File::Exists(avcodec) && File::Exists(avformat) && File::Exists(avutil) && |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Source/Core/DolphinQt2/MenuBar.cpp
Outdated
| movie_menu->addSeparator(); | ||
|
|
||
| #if defined(_WIN32) | ||
| if (FFmpeg_Win32_Exists() == true) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Source/Core/DolphinQt2/MenuBar.cpp
Outdated
|
|
||
| #if defined(_WIN32) | ||
| #include <Common/FileUtil.h> | ||
| void MenuBar::DumpFrames_FFmpegNotFound_Win32() |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Source/Core/DolphinQt2/MenuBar.cpp
Outdated
| #include <Common/FileUtil.h> | ||
| void MenuBar::DumpFrames_FFmpegNotFound_Win32() | ||
| { | ||
| const QString dol_root_dir = tr(File::GetExeDirectory().c_str()); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
|
I'm a +1 on this, and it has always been something that I wanted to have done with ffmpeg on Dolphin. This should cut out not only custom building the dll files, but also distributing them and opens up the possibility of allowing any supported codec being used for frame dumping. |
|
@RisingFog I just squashed them before uploading this branch, I had them separate, I've read some stuff and I guess it confused me and I squashed too early. I still have the old branches and backup copies, but you're suggesting I can just split this here into two commits? I didn't know that's possible so I'll go read up on that. That's said, I have a bit of a question regarding my rename to the |
|
@Zexaron They're only required for Windows, Linux/macOS grabs the dependencies on compile from the OS directly (if the dependencies are installed/available). |
|
@RisingFog Just to clear out, If I deleted the @RisingFog I've read up on commit splitting, it's not the simplest thing and I don't want to mess this PR up, so may take some time because I should do a push test to another non-pr branch too. I'm aware that more commits is easier for reviewing, but in this case does it also matter when merging? I would then just keep amending changes (not many of them) and do a commit split later once I figure it out better, fine? |
|
Splitting is fairly easy; open git gui, check "amend last commit" and remove everything that isn't the folder rename - then commit it with a new message. Everything else thats left is the other changes. |
|
@BhaaLseN Thanks for the tip. Unfortunately I've unticked the GUI component when installing the 2.17 version a few months ago. I already plan to include it when I do a reinstall, but probably not a good idea to do that in the middle of this PR, IMO. |
|
@Zexaron It would compile on linux/macOS without that folder. |
|
I wasn't aware you could actually not install |
|
Fixed all of these points but commit split would have to wait until tomorrow at earliest, as it would probably stretch deep into the night. @BhaaLseN It's a bit of a long story, a bit offtopic but in short, in the beginning last year I thought GitForWindows was it's own thing (some unreliable random source) but then official git-scm links to it, but I thought there were two for windows. I used it a bit before, but I settled with Bash, and after a fresh Win10 install 3 months ago I remember unticking it in the installer, since then I wanted to try the GUI again, but I couldn't find it in Program Files. However I forgot to confirm with a search, which I did right now, and I found git-gui.exe, why on earth is it not in the root directory like git bash and cmd. So maybe there's 2 different GUIs after all, in one program. No need to worry, I'll figure it all out tomorrow, too late today. |
|
IMO it would be nicer to just have a yes/no click-through which would download and extract the needed files (maybe drop back to the instructions given in the current state if it fails). But that can be done in a different PR (if anyone wants to implement it). |
|
@shuffle2 That was the original plan indeed. The choice is to use this as is, temporairly, or wait until that is done separately and then merge both at a later date? EDIT: Commit split complete, hopefully this even better. EDIT2: Wondering how checking/crash prevention is done in non-Windows OS ... Current Diff UPD3: Diff Link Updated |
Source/Core/DolphinQt2/MenuBar.cpp
Outdated
| [](bool value) { SConfig::GetInstance().m_DumpFrames = value; }); | ||
| static bool ffmpeg_notfound_win32 = false; | ||
| #if defined(_WIN32) | ||
| if (FFmpegWin32Exists() == false) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Source/Core/DolphinQt2/MenuBar.cpp
Outdated
| } | ||
|
|
||
| #if defined(_WIN32) | ||
| #include <Common/FileUtil.h> |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Source/Core/DolphinQt2/MenuBar.cpp
Outdated
| #if defined(_WIN32) | ||
| static bool FFmpegWin32Exists() | ||
| { | ||
| const std::string avcodec = File::GetExeDirectory() + "\\" + "avcodec-58.dll"; |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
|
@RisingFog Those .lib dependencies are still required due to the way I implemented delayed loading support. Simply specifying the DLL filenames under /DELAYLOAD uses the VS helper function which does this under the hood automatically, it's hidden, so you won't see it in the source. Otherwise much more code changes and effort would have been required with manual implementation of the LoadLibrary/GetProcAddress. |
|
@Zexaron Alright, I didn't see that the new lib files were added in the diff. Ignore my review then for that. |
|
@RisingFog Oh ok, maybe if you tick the "Approve Changes", might get rid of them. |
|
@Zexaron No, reviews don't work that way. |
Source/Core/DolphinQt2/MenuBar.cpp
Outdated
| { | ||
| QClipboard* clipboard = QApplication::clipboard(); | ||
| QString ffmpeg_win64_shared_url = | ||
| tr("https://ffmpeg.zeranoe.com/builds/win64/shared/ffmpeg-4.0-win64-shared.zip"); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Source/Core/DolphinQt2/MenuBar.h
Outdated
| QAction* m_recording_stop; | ||
| QAction* m_recording_read_only; | ||
| #ifdef _WIN32 | ||
| QAction* m_dump_frames_noff_win32; |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
|
Is there a specific reason to use delayloading instead of just LoadLibrary/GetProcAddress? |
|
@shuffle2 AFAIK delayloading just uses the helper function which does the LoadLibrary/GetProcAddress automatically, but the point is to have it delay loaded, not startup loaded, in other words, optional, if it's that easy just adding some DLL filenames to a setting it's well worth it. |
|
I wanted to rebase, just had a BSOD while in interactive rebase, why is my Win10 doing this to me now. Index file got corrupt for the whole Dolphin repo, sorry this is going to take some time and I'm busy with other health stuff. I might have to first fix the BSODs I had a few, it could be HW failing too. There was no action happening, it was just in the middle of the rebase waiting for manual edits, index shuldn't be that easily corruptible, this is some serious issue if just an untidy shutdown of bash/cmd/mintty would cause this. The index file shows NULNULNUL ... and same thing happened on an untidy shutdown before without any BSODs. |
|
I've had that happen before as well, my guess is it has something to do with disk write caching. I don't see how just an unclean shutdown of the terminal would corrupt the git index, as it doesn't store any state in the terminal session. |
| // can be downloaded at no cost, but that's not what this message says.) | ||
| text.append(medium + tr("Dolphin is a free and open-source GameCube and Wii emulator.") + | ||
| QStringLiteral("</p>")); | ||
| text.append(medium + |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
|
Looks like thing are going a bit better with my PC stability, I've imaged my Win10 off the Samsung 860 EVO 250GB to a similarly fresh 850 EVO 250GB which I had laying around meant to put a fresh install of Win7 on, and put it on another sata port as well as different sata cable, been working for 2 days now, but not so fast, still have to do more checks/test and just giving it some time, including using linux on a third 840 Pro SSD and putting that on the first port and the same cable, if linux has a kernel panic then it has to be the port or the sata cable or something in the controller/motherboard, ruling out the 860 as the culprit. I know it's not directly relevant to this PR, but what I'm trying to get to is the schedule, if this PR won't get merged temporairly before the auto-ffmpeg-downloader PR is done (any volunteers?), then there's no point for me to rush here. |
|
Is there any update on this PR? |
|
@RisingFog I'm still around, althought unfortunately still dealing with the PC hardware troubleshooting and maintenance, various side-chores have opened up, had to be done first, other PCs got problems, I've had 5 hardware failures in less than 6 months, 3 warranties, after no issues for like 4 years, it's just bad coincidence, and I simply can't get to fixing the dolphin git repo until I get my PC back - I'm closer, I think one of the newer SSDs is randomly locking up after less than 2 months of use, since it's happeing on other SATA ports as well, now I have to test it on another PC, but the nature of the problem is that it takes time, each configuration case I have to play around a bit and wait, so iteration is slow, but also becuase I have a lot of life stuff going on with the home improvement stuff, new appliances etc. It's still up in the air for this PR, if there's an update, it would come in another PR, the updater/downloader for ffmpeg. But ofcourse I will resolve the conflicts in this PR ASAP. Plus, I was also going to update git and maybe learn/familiarize with one of the GUIs, so there's all of that as well. |
|
I can't think of a situation where you'd like ffmpeg delay-loading elsewhere than on Windows. On Linux it's not like people randomly go and install shared libraries but don't expect to have to recompile to use them. And there's the whole mess of ABI compatibility if you start wanting to make something generic... which I don't think is worth trying to solve. |
|
This is the situation I was thinking of - make libavcodec an optional dependency, which could be added later without recompiling. But indeed, header versions/ABI differences could make it an issue. That said, I'm still not sold on the linker-based method, due to the points above, but I'm not gonna bikeshed too much about it :P |
|
And I thought being windows-specific was a good thing, but it's not the delayed-loading that makes it platform specific right, it's the libaries them selfs. The reasons for delayed-loading is for either or both of the two main issues I saw pretty early on, avoiding shipping ffmpeg with every release of dolphin and avoiding forcing all users to have it installed even if they're not going to use any functionality that requires FFmpeg. Now if everyone doesn't care about the shipping size or the hosting space, there would be no need for delayed-loading nor user installation ... otherwise this PR doesn't add anything and actually relieves around 1.5 MB, with average 4 releases per day, 2 TB of saved space in a year. |
|
The wiki page has been set and it's under construction, in the meantime I added a temporary installation text from the original warning message. |
|
Warning for localization: trailing spaces here on purpose for a quick button width fix so that the border doesn't touch the text, otherwise I think a lot more code would be needed to adjust the width, unless if there's a shorter way that someone knows how to adjust the width without having to define the whole dialog element-by-element. |
|
If you want to warn localizers, make an i18n comment in the code. |
|
Done, althought it's a bit awkward positioning, would the |
|
The i18n comment has to be right above the string, not below. And using arrows won't make sense to localizers. You should also make sure the comment refers to both the leading and trailing spaces, not just the trailing one. |
|
Corrections applied. |
|
No, the i18n comment has to be on the line right above the string, not 7 lines before. |
|
Would it be alright if the "Copy to URL to clipboard" button is to be changed into just "Open Wiki" and it will open the URL in user-defined default browser, much like the "Wiki" button you see in context menu from game list? If you like this idea, may I also suggest drop the blue text, the button got it covered. |
|
I'd hope to have at least one redundancy, but whatever. Install instruction is a bit more critical if the user can't get to them IMO. We'll see what people think, or they may just like it how it is, but as far as me goes I'm fine with this as well. The i18n line should be fixed now, I thought that wouldn't build. The wiki's also beginning to be shaped, but the primary thing, the install instructions, are more or less good for practical use as of now. |
|
Many linux distros are using ffmpeg 4.0.2 for their testing/unstable build - ffmpeg is updated here as well to match, includes, libs, and wiki. @Rukario There that should make everyone happy now !!! It's was actually a good idea, it got rid of the hack I had to make to widen the button. |
Source/Core/DolphinQt/MenuBar.cpp
Outdated
| #include "UICommon/GameFile.h" | ||
|
|
||
| #if defined(_WIN32) | ||
| static bool FFmpegWin32Exists() |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
|
@spycrab Okay, I put it in |
|
Won't piping over to whatever version of ffmpeg is available on the system make it easier than linking a shared lib? That would allow to just use whatever commands are supported by the given ffmpeg build, nothing would have to be explicitly loaded, no internal dependencies/symbols to resolve (I hope I'm understanding this correctly). |
|
The Zexaron account doesn't exist anymore, meaning this PR can't be updated, so... |
|
Could you still comment on my suggestion? |
|
It's not really the area of Dolphin I focus on, but... I guess it has the disadvantage of making things harder to set up for people who just want a quick and easy dump (not TASVideos.org quality) but doesn't really have disadvantages other than that? The disadvantage doesn't sound too bad to me considering that only a small subset of users use frame dumping, but I can't speak for what the other devs think. |
|
If ffmpeg is not found, an error message with a link makes it rather trivial imo. On the other hand, having it in PATH permanently means you only download it once and all dolphin installations and portables can use it. It's also nice to have a couple default ffmpeg commands and a way to change them. |
|
Intent to revive this on my own, anyone objecting? |

I thought it would be a good first step for future framedumping improvements.
Externals/ffmpegfolder toExternals/ffmpeg-win64to make that more obviousLICENSE.txtandREADME.txtfiles added (FFmpeg's license compliance recommendation point 2 states that using dynamic linking to DLLs is the preferred way of using it in another program )Added FFmpeg text to Dolphin's about box (Qt) as recommended in point 10 of the FFmpeg license compliance checklist.Auto downloading addedDetailed explanation here:
Dolphin Forums - Framedumping Research
Version 1.0 of the warning message

...
Version 5 of the warning message
