UltraStar-Deluxe / USDX

The free and open source karaoke singing game UltraStar Deluxe, inspired by Sony SingStarâ„¢
https://usdx.eu
GNU General Public License v2.0
863 stars 162 forks source link

ffmpeg 4.0 support #369

Closed kyrios123 closed 6 years ago

kyrios123 commented 6 years ago

ffmpeg is only supported up to 3.3

checking version of ffmpeg... configure: error: 

Unsupported ffmpeg version, most recent version supported is 3.3.

Support ffmpeg 4.0

checking version of ffmpeg... [4.0]

(and then successfully build the application)

Steps to reproduce

Do a successful build with ffmpeg <= 3.3 Install ffmpeg 4.0 (with devel), execute the same build again.

Details

Provide some additional information:

bxabi commented 6 years ago

Hi, I have the same issue on Arch linux. The old ffmpeg is not available anymore. Can you direct me a bit where in the code should I look around and adapt it to the newer version?

bohning commented 6 years ago

@mttronc, maybe you can help here again?

mrtnmtth commented 6 years ago

Have not had a look at ffmpeg 4.0 yet. But sure, I can give it a try. Though I won't be able to test the changes myself, since I use Debian testing which has not migrated to 4.0 yet.

mrtnmtth commented 6 years ago

A lot of deprecated stuff got removed in version 4.0. USDX should upgrade deprecated API calls and test those against currently supported ffmpeg versions before adding ffmpeg 4.0 support.

This is going to require quite a bit of work...

bohning commented 6 years ago

Would acinerella or libVLC be a better way to go? @basisbit, what is your take on future FFMPEG support?

s09bQ5 commented 6 years ago

What if someone wrote a small C application that can be compiled and run at build time to generate pascal headers just for the parts of the FFmpeg API that we need in USDX? This should work at least for the structures and constants. It would be easy to create a list of needed structure elements and constants as USDX will not compile as long as we are still missing some.

Function prototypes rarely change in FFmpeg. We could make the C compiler emit an error if the prototype changed to something unexpected.

basisbit commented 6 years ago

Acinerella or libvlc would be awesome instead of directly fiddling with ffmpeg api. If someone has the free time for that, please go ahead! Acinerella actually changed their license to gplv2+ on our request some time ago. Personally, I lack the time/motivation to code anything in pascal.. Sorry. This is a free/libre oss project, so everyone can participate :)

mrtnmtth commented 6 years ago

This is going to require quite a bit of work...

I take that back. As far as I can see, USDX is only affected by the removal of audio resampling in libavcodec. The migration is to use swresample instead. Since audio resampling is only used in UAudioConverter.pas the changes should be an easy task for somebody who knows what he is doing (not me - I already tried and failed).

I agree with @s09bQ5. The work would be a lot less if you would provide only the ffmpeg functions needed in USDX instead of creating Pascal bindings for the whole API.

brianch commented 6 years ago

Should be working now.

The ffmpeg headers (luckily) aren't changing as much as before, the translation itself was only a matter of one night's work, the problem is when something big gets deprecated, like happened some time ago, I think in version 2, and force us to change the usdx media code (that I think nobody really understands).

bohning commented 6 years ago

Thanks a lot, it is highly appreciated, @brianch. Just tested it on OSX 10.13.5 with ffmpeg stable 4.0 (brew) and it works like a charm =)

kyrios123 commented 6 years ago

thanks a lot for the patch ! :smile:

bohning commented 6 years ago

@brianch @basisbit, should the Windows version of ffmpeg also be updated to 4.0?

basisbit commented 6 years ago

that would drop support for anything older than vista according to this

Dropped support for building for Windows XP. The minimum supported Windows version is Windows Vista.

Not sure there is much advantage of ffmpeg 4.0 for usage within a karaoke game. I still see tons of karaoke setups using Windows XP + UltraStar Deluxe out there. What do you all think about this?

brianch commented 6 years ago

I agree, I don't think the update is very important, even more if it drops support for XP.

By the way, I didn't know but according to this the zeranoe builds have dropped support for XP long ago: https://ffmpeg.zeranoe.com/forum/viewtopic.php?t=2937

In the homepage it also says that "All builds require at least Windows 7 or Mac OS X 10.10"

===== And about ffmpeg 4 in general, with it the audio playback is currently being resampled by SDL* (the swresample code isn't working yet). Is this ok (the SDL resampling)? I didn't notice any problems, but if anyone sees something please report it.

*There's also a libsamplerate converter, but I don't remember if we are even checking for the presence of this lib in the configure script, I may take a look into this when I find time.

s09bQ5 commented 6 years ago

We could do our own build of FFmpeg for Windows. The script for building Zeranoe's toolchain is here. The configure options they use for FFmpeg builds are mentioned in the README.txt. Most of the libraries they link to can be dropped. We are only interested in demuxers, decoders, swscale, and swresample.