MP4 codec support in Chromium - windows

We have integrated Chromium Embedded Framework into our Windows game to allow us to render web pages from within our application, and everything works fine, except MP4 videos.
I understand Chromium does not include this codec due to licensing issues, but can anyone provide details on how we can add support, even if we have to license a codec for it.
All the information we can find seems to be old, and the functions referred to appear to be deprecated... so we are at a bit of a loss.
All the video serving networks we have spoken to appear to serve MP4s.. so changing encoding does not seem to be an option.
Any advice would be greatly appreciated.
Thanks

Check this url
Go to menu option Features --> Html5 Audio/Video section. It mentions that Nik's build (66.0.3359.181) has supported Mp4 (and other codecs).
If there is any licensing issues with using H.264/MP4, I am not aware about it, so please check for it before using.

Keep in mind that MP4 is not a codec it's a container format. You need to support all codecs that might be contained in a MP4 file.
In a recent post on a CEF forum someone managed to do it by setting the environmental variable:
GYP_DEFINES="proprietary_codecs=1 ffmpeg_branding=Chrome"
before running the automate-git.py script.
Source: Build CEF with proprietary codecs support

Related

Legal issues in shipping apps based on Electron framework (libffmpeg)

We're in the process of building and deploying a desktop based app on electron v 12.0.7. It'll be a (free) commercial software deployed to ~2-3M users worldwide.
Recently our legal team enquired about the proprietary codecs bundled with chromium and I thought the best way to confirm this would be to reach out here.
So, here're specific things that I need help with:
Are we shipping chromium with proprietary codecs? If yes, what are potentially contentious codecs that come by default in chromium bundled with electron v 12.0.7?
Is there any documentation around how the electron team builds chromium (with what flags)?
Is the default libffmpeg.dylib/dll bundled with electron building ffmpeg with support for things like H.264 and MP3 codecs?
I noticed there are libffmpeg binaries available with each electron build, e.g. https://github.com/electron/electron/releases/download/v12.0.7/ffmpeg-v12.0.7-darwin-arm64.zip . What's the purpose of this binary?
Any help would be appreciated.
Ok, it took a while to plummet through all the information out there.
I started wth https://github.com/electron/libchromiumcontent/issues/174#issuecomment-184187254 and ended up on electron's discord server talking with multiple folks from electron team. I'm collating my findings here so that it may save some time for someone.
Here're what I found out. Any corrections/edits are more than welcome so that the information presented here is correct.
Are we shipping chromium with proprietary codecs?
If yes, what are potentially contentious codecs that come by default in chromium bundled with electron v 12.0.7?
YES. At least on OSX, the libffmpeg.dylib that comes by default with electron contains exported symbols (for proprietary decoders) for AAC and H264. So, they remain in the realm of non-royalty-free software. I think legal advice is required here if you're planning to ship your application commercially(using default electron + libffmpeg.dylib)
e.g. List of exported decoders from the dylib can be viewed using the following command:
nm -gU /Applications/{your-app-name}.app/Contents/Frameworks/Electron\ Framework.framework/Versions/A/Libraries/libffmpeg.dylib | grep 'decoder'
I wrote a simple python script to look at any electron-based app, and print list of decoders available inside libffmpeg (bundled inside an electron based app).
Sample output from my script: (My app is built with electron v 12.0.7)
Decoders available/exported from libffmpeg.dylib: ['aac', 'aac-latm',
'flac', 'h264', 'libopus', 'mp3', 'pcm-alaw', 'pcm-f32le',
'pcm-mulaw', 'pcm-s16be', 'pcm-s16le', 'pcm-s24be', 'pcm-s24le',
'pcm-s32le', 'pcm-u8', 'theora', 'vorbis', 'vp3', 'vp8']
So defintely we have aac and h264 decoders (non-royalty-free-software) going out by default with our electron-based application. To the best I know, these could lead to possible patent-infringement issues.
2. Is there any documentation around how the electron team builds chromium (with what flags)?
I couldn't find any conclusive documents but https://github.com/electron/electron/blob/58c58c46c4e03c996983a0c71163e1a5efed12fa/build/args/all.gn hints that by default proprietary_codecs is set to true in electron's build
3. Is the default libffmpeg.dylib/dll bundled with electron building ffmpeg with support for things like H.264 and MP3 codecs?
It certainly looks to be the case (based on above)
4. I noticed there are libffmpeg binaries available with each electron build, e.g. https://github.com/electron/electron/releases/download/v12.0.7/ffmpeg-v12.0.7-darwin-arm64.zip . What's the purpose of this binary?
If you care about shipping royalty free binaries and not deal with patent issues, this is what probably you should use (unless you chose to build whole electron by yourself tweaking gn args).
A quick check of these ffmpeg.dylib reveal that AAC and H264 decoders are not present(or atleast it doesn't have exported symbols for them). So it leads me to believe that these custom versions of dylib are built by electron team keeping this in mind. Using same script this is the output for list of decoders available in custom version of libffmpeg
Decoders available/exported from libffmpeg.dylib: ['flac', 'libopus',
'mp3', 'pcm-alaw', 'pcm-f32le', 'pcm-mulaw', 'pcm-s16be', 'pcm-s16le',
'pcm-s24be', 'pcm-s24le', 'pcm-s32le', 'pcm-u8', 'theora', 'vorbis',
'vp3', 'vp8']
So this is the difference between two versions of dylib (left one is downloaded from electron site, right one is what comes by default with electron)
It also appears that this problem was already identified and we have a plugin for electron-packager that does all the heavy-lifting for you: https://github.com/MarshallOfSound/electron-packager-plugin-non-proprietary-codecs-ffmpeg
Since we din't use electron-packager (but electron-builder), i had to resort to put this logic of replacing libffmpeg in afterPackHook
: https://www.electron.build/configuration/configuration#afterpack
Important step to remember is that: this replacement needs to be done before we code-sign the whole app (or it breaks the code-sign integrity).
Hope it helps someone else going through the same problem.
Cheers!

Where can I find ffmpeg codecs for Windows Chromium (h.264, AAC, mp3..)?

In previous version you could copy files from google Chrome's folders and paste them into the Chromium files, but that doesn't work anymore. Apparently all the files have been replaced by 1 file ffmpegsumo.dll, copying that from Chrome changes nothing.
I downloaded codecs for Chromium on linux, but I find it weird that there's no way to get them for Windows.
Why don't they just add h.264 to chromium now that cisco made it royalty free?
Google has little incentive to support H.264 when they have their own, competing format WebM that they are trying to push. (Haven’t you ever wondered why such a relatively unknown format is one of the formats the YouTube, a Google subsidiary, supports natively?)
Unfortunately, as you have learned, they re-structured Chromium so that you cannot easily drop in H.264 support as you could before. What you can try instead, is to use the Microsoft plugin that lets Chromium play H.264 through Windows Media Player. Because it is a plugin, it should still work—unless Google specifically blocked it.

How to do Simple video streaming with ffserver on windows?

I found a tutorial for configuring server here http://www.organicdesign.co.nz/Simple_video_streaming_with_ffserver
but it is for linux... how to do such thing on windows? (with a real web cam)
Dont think ffserver exists on windows, my suggestion is to set up a linux box(ubuntu?) and play with ffserver there :)
Although, I too have read, in older posts, that builds for Windows are non-existing, this morning I found (not me, but google) this blog: https://www.virag.si/2012/11/streaming-live-webm-video-with-ffmpeg/
Comes with a small guide also!
But as an alternative to ffserver, I would recommend rtmplite (you need python, but is extremely easy to use - at least in dev), or if you have java experience and alot of patience and time, red5!
download and install ICECAST server. It works for windows and ffmpeg and lets you live stream a video in mp4 and webm which you can publish and showcase online with html and php. Its the easiest way. I wish someone had told me this but I had to figure this out, thru trial and error. If this doesn't work for you type live stream server software on google search engine. http://icecast.org/ code that should configure it with ffmpeg https://www.ffmpeg.org/doxygen/2.4/icecast_8c_source.html. ffserver does no work for windows and its a huge waste of time.

Is There a Windows Video Codec Common Dialog?

Does Windows have a common dialog to select video codecs? If there is one, how can I create one in c#? I'm asking because I'm currently developing with a plugin that seems to have included extremely dated codecs, and am not sure if the plugin is simply retrieving a list of codecs from the system. I don't have the source of the plugin, so I can't look at the source code directly.
Attached is a screenshot of the dialog:
Screenshot http://www.freeimagehosting.net/uploads/fb936bd413.png
Thanks!
That looks like the save options dialog from Video for Windows. Specifically, I believe that's the dialog that pops up when you use the AviSaveOptions function from avifil32.dll.
You could probably call that from C# using P/Invoke if you wanted to.
The dialog does get a list of video codecs from the system. However, VfW only supports VfW codecs, not the newer DirectShow codecs. Any of the more modern codecs you might have installed on your system are going to be DirectShow codecs, more likely than not.
If you want a more modern codec, you're going to have to install a VfW version of that codec.
No, there is no directly accessible codecs list available in the form of a CommonDialog in C#.
CFP.

Which video and audio format/codec should I use?

Environment: Windows XP/Vista, VS2008, C#/.NET 2.0, VideoGrabber.
Hi All,
I'm writing an app which captures cameras input and encodes them into a movie file (including sound).
My client suggests I encode the movie using the DivX codec. But it's not installed by default and it's not redistributable: Users would have to download, install and configure it themselves.
Is there a Codec available in default Windows (XP+) installations that I could use to encode video and sound? It must support compression. Ideally, I should be able to programmatically set basic configuration.
Note: I read this question but it doesn't actually address my needs.
TIA,
Is there a Codec available in default Windows (XP+) installations that I could use to encode video and sound?
About the best you can hope for is WMV2 (WMV v8). You may be able to encode it using qasf.dll.
The codecs you get for AVI in XP are all woeful efforts from the early days of ‘Multimedia PCs’: things like Cinepak and RLE, which are of zero use for modern full colour/resolution video, and Intel 4:2:0, which is only chroma subsampling, not really actual video compression.
If you need better than that you'll have to start embedding your own codecs, eg. from ffmpeg.
But it's not installed by default and it's not redistributable: Users would have to download, install and configure it themselves.
That's best anyway. Silently installing codecs onto a system is rather antisocial as there are often clashes between them and you could end up messing up other DirectShow applications. For example there are (at least) three different common DirectShow codecs that can handle “DivX” (which is really nothing more than MPEG-4 Advanced Simple Profile video plus MP3 audio in an AVI container): DivX, Xvid and ffdshow. Having more than one installed can be a recipe for bugs.
Not sure how useful this is to you, but I was trying to answer that very question just recently. This article suggests DIB, I420, or IYUV are supported on all platforms... at least in OpenCV. I had the least trouble with I420.

Resources