3

Under version Qt5.2, I used QtWebView, it can call third-party extensions automatically to support video formats such as avi, mpeg, mov and flv. But when I upgraded to Qt5.10 and changed QtWebView to QtWebengineView, it worked differently and I couldn't call third-party extensions. If I want to modify chromium source with ffmpeg to support all video formats for QtWebengine, what should I do?

Ray
  • 61
  • 1
  • 1
  • 4

4 Answers4

2

You needn't to use ffmpeg to support all video formats.

Like Vladimir said, follow the official build instructions and the audio/video page.

@Vladimir: I don't think you can enable support of the video & audio formats that aren't supported by Google Chrome.

Yes, you can. We compile Chromium with all codecs (AVC/H.264, HEVC/H.265, MPEG-4...) and can open many other file types (MOV, AVI, MKV, M2TS...). Follow our instructions (GN flags) and you will be able to build Chromium with all codecs. HEVC/H.265 is more complex. Check Chromium binaries and file type checker. All is completely free and open-source. Do it yourself! ;)

Jerry
  • 146
  • 3
  • QtWebengine is based on Chromium 33.0.1750.170. :( – Ray Jul 09 '18 at 12:58
  • 1
    Yes Ray. It is very too old :/ Check Chromium Embedded Framework, Electron, Chromely, NW.js – Jerry Jul 10 '18 at 04:45
  • Sorry. I did not see QtWebView is based on Webkit while Chromium is based on Blink (a webkit fork). – Jerry Jul 10 '18 at 05:02
  • @Jerry you can compile Chromium will all SUPPORTED codecs including free (Opus, Theora, WAV, etc.) and proprietary (H.264, MP4) codecs disabled in Chromium by default. If Google Chrome (not Chromium) doesn't support some video & audio formats (e.g. some very custom video formats), then there's no way to enable this format when building Chromium. Chromium just doesn't have the necessary source code for such custom video formats. – Vladimir Jan 10 '19 at 11:19
  • @Vladimir I globally agree with you but technically Chromium being open-source you can add UNSUPPORTED image/text/audio/video formats and codecs if desired. But I recognize it is a lot of work. For example, all formats supported by FFmpeg (https://ffmpeg.org/ffmpeg-formats.html) - FFmpeg is already inside the Chromium source code - can be natively supported in Chromium. My question is why? Chromium is a browser, not a swiss knife! :) – Jerry Jan 11 '19 at 12:31
  • @Jerry I agree with you. My point was that it's impossible if you don't extend Chromium source code with additional codecs and formats. – Vladimir Jan 11 '19 at 16:14
1

If you are building Chromium using the official build instruction, then you just need to add the following options to the args.gn file:

proprietary_codecs=true
ffmpeg_branding="Chrome"
Vladimir
  • 1
  • 1
  • 23
  • 30
  • It enables support for all audio and video formats supported by Google Chrome. – Vladimir Jun 22 '18 at 14:45
  • I tried. I need support avi,mpeg,mov,flv and so on. Google Chrome supports Ogg,WebM,WAV,MP4. see https://www.chromium.org/audio-video – Ray Jun 22 '18 at 14:53
  • I don't think you can enable support of the video & audio formats that aren't supported by Google Chrome. – Vladimir Jun 22 '18 at 16:51
1

For QtWebEngine all you need to do is configure Qt to enable proprietary codecs using -proprietary-codecs (< Qt 5.12) or -webengine-proprietary-codecs (Qt 5.12+)

If you additional configure with -system-webengine-ffmpeg you will also use the system FFmpeg with all the codecs it supports. It still won't support any container formats Chrome doesn't though.

Allan Jensen
  • 518
  • 4
  • 8
0

Without -webengine-proprietary-codec -system-webengine-ffmpeg qtwebengine will support the following

audio codecs: opus, vorbis, flac.

video codecs: vc8, vc9.

QtWebEngine is able to play your videos if recode your videos like this:

ffmpeg -i video.mp4 -c:v vp9 -c:a libopus -f webm video.webm
biruk1230
  • 3,042
  • 4
  • 16
  • 29