[Resolved]How to build ffmpeg as a shared library on MacOS?

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

[Resolved]How to build ffmpeg as a shared library on MacOS?

Postby lypkiller » Mon Dec 07, 2020 1:23 am

Hi Guys,
Due to the H264 license issue, I want to build the cef with ffmpeg as dynamic library, for example, libffmpeg.dylib.

According to "https://gitlab.com/noencoding/OS-X-Chromium-with-proprietary-codecs/-/wikis/List-of-all-gn-arguments-for-Chromium-build", look like following 2 options could help:
is_component_build
and
is_component_ffmpeg

So I have tried to build the cef on MacOS:
# export CEF_USE_GN=1
# export GN_DEFINES="proprietary_codecs=true is_component_build=true is_component_ffmpeg=true ffmpeg_branding=Chrome"
# export CEF_ARCHIVE_FORMAT=tar.bz2
# python automate/automate-git.py --download-dir=~/cef/chromium_git \
--branch=4280 \
--client-distrib --x64-build

Finally, it didn't generate the dynamic library "libffmpeg.dylib" in cef framework. The "~/cef/chromium_git/chromium/src/out/Release_GN_x64/args.gn" contents:
chrome_pgo_phase=0
clang_use_chrome_plugins=false
enable_background_mode=false
enable_basic_printing=true
enable_dsyms=true
enable_nacl=false
enable_print_preview=true
enable_resource_allowlist_generation=false
enable_widevine=true
ffmpeg_branding="Chrome"
forbid_non_component_debug_builds=false
is_component_build=true
is_component_ffmpeg=true
is_debug=false
optimize_webui=true
proprietary_codecs=true
target_cpu="x64"



Look like "is_component_ffmpeg" doesn't help, is it just for Linux platform? since it says:
is_component_ffmpeg
Current value (from the default) = false
From //third_party/ffmpeg/ffmpeg_options.gni:41

Set true to build ffmpeg as a shared library. NOTE: this means we should
always consult is_component_ffmpeg instead of is_component_build for
ffmpeg targets. This helps linux chromium packagers that swap out our
ffmpeg.so with their own. See discussion here
https://groups.google.com/a/chromium.or ... k0zzmJbvcJ


Any idea to build the dynamic library for ffmpeg on MacOS?
Last edited by lypkiller on Fri Dec 11, 2020 2:54 am, edited 1 time in total.
lypkiller
Techie
 
Posts: 12
Joined: Mon Jan 20, 2020 4:14 am

Re: How to build ffmpeg as a shared library on MacOS?

Postby vmas » Mon Dec 07, 2020 1:43 am

Try changing the is_component_ffmpeg value directly in chromium\src\third_party\ffmpeg\ffmpeg_options.gni.
Maintainer of the CefNet project.
vmas
Techie
 
Posts: 13
Joined: Mon Feb 24, 2020 4:03 am

Re: How to build ffmpeg as a shared library on MacOS?

Postby magreenblatt » Mon Dec 07, 2020 10:15 am

Due to the H264 license issue, I want to build the cef with ffmpeg as dynamic library

How does this help you with H264 licensing?
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: How to build ffmpeg as a shared library on MacOS?

Postby lypkiller » Mon Dec 07, 2020 8:39 pm

magreenblatt wrote:
Due to the H264 license issue, I want to build the cef with ffmpeg as dynamic library

How does this help you with H264 licensing?

magreenblatt,
According to http://ffmpeg.org/legal.html:
2 Use dynamic linking (on windows, this means linking to dlls) for linking with FFmpeg libraries.


Hence, I expect to have ffmpeg as dynamic library.
lypkiller
Techie
 
Posts: 12
Joined: Mon Jan 20, 2020 4:14 am

Re: How to build ffmpeg as a shared library on MacOS?

Postby magreenblatt » Mon Dec 07, 2020 8:59 pm

That link is about LGPL compliance. By using CEF as a DLL it is already LGPL compliant, unless you are compiling proprietary code into a custom CEF build. Licensing H264 is a whole different matter, see https://www.mpegla.com/programs/avc-h-264/.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: How to build ffmpeg as a shared library on MacOS?

Postby lypkiller » Mon Dec 07, 2020 9:23 pm

magreenblatt wrote:That link is about LGPL compliance. By using CEF as a DLL it is already LGPL compliant, unless you are compiling proprietary code into a custom CEF build. Licensing H264 is a whole different matter, see https://www.mpegla.com/programs/avc-h-264/.

magreenblatt,
Big thanks.

And for the technical issue, essentially, can we use the "is_component_build" or "is_component_ffmpeg" to build the cef with individual dynamic library?

Thanks in advance.
lypkiller
Techie
 
Posts: 12
Joined: Mon Jan 20, 2020 4:14 am

Re: How to build ffmpeg as a shared library on MacOS?

Postby amaitland » Mon Dec 07, 2020 9:27 pm

mp4 is often H264 (video) + AAC (audio)

You would also likely need to license AAC see https://www.via-corp.com/licensing/aac/
Maintainer of the CefSharp project.
amaitland
Virtuoso
 
Posts: 1292
Joined: Wed Jan 14, 2015 2:35 am

Re: How to build ffmpeg as a shared library on MacOS?

Postby magreenblatt » Mon Dec 07, 2020 9:50 pm

And for the technical issue, essentially, can we use the "is_component_build" or "is_component_ffmpeg" to build the cef with individual dynamic library?

Sorry, I don’t know. I’ve never tried it and it’s not supported.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: How to build ffmpeg as a shared library on MacOS?

Postby vmas » Tue Dec 08, 2020 11:10 am

lypkiller wrote:And for the technical issue, essentially, can we use the "is_component_build" or "is_component_ffmpeg" to build the cef with individual dynamic library?

A few months ago I successfully compiled the ffmpeg dynamic library on Windows with the is_component_ffmpeg option. But I changed the value to true directly in ffmpeg_options.gni.
Maintainer of the CefNet project.
vmas
Techie
 
Posts: 13
Joined: Mon Feb 24, 2020 4:03 am

Re: How to build ffmpeg as a shared library on MacOS?

Postby lypkiller » Fri Dec 11, 2020 2:53 am

vmas wrote:
lypkiller wrote:And for the technical issue, essentially, can we use the "is_component_build" or "is_component_ffmpeg" to build the cef with individual dynamic library?

A few months ago I successfully compiled the ffmpeg dynamic library on Windows with the is_component_ffmpeg option. But I changed the value to true directly in ffmpeg_options.gni.


vmas,
Thanks for your tip. I also could compile cef successfully with directly setting is_component_ffmpeg=true. but need to change some link option on MacOS platform.

For example, when had following errors:
Code: Select all
# ninja -j 10 -C out/Release_GN_x64 cef
ninja: Entering directory `out/Release_GN_x64'
[5655/6334] ACTION //tools/v8_context_snapshot:generate_v8_context_snapshot(//build/toolchain/mac:clang_x64)
FAILED: v8_context_snapshot.x86_64.bin
python ../../build/gn_run_binary.py ./v8_context_snapshot_generator --output_file=v8_context_snapshot.x86_64.bin
dyld: Library not loaded: @rpath/libffmpeg.dylib
  Referenced from: /Users/yongping.li/cef/chromium_git/chromium/src/out/Release_GN_x64/././v8_context_snapshot_generator
  Reason: image not found
./v8_context_snapshot_generator failed with exit code -6
ninja: build stopped: subcommand failed.

Need to change v8_context_snapshot_generator.ninja,then append "-Wl,-ObjC -Wl,-rpath,@loader_path/. -Wl,-rpath,@loader_path/../../.." into ldflags.
lypkiller
Techie
 
Posts: 12
Joined: Mon Jan 20, 2020 4:14 am


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 43 guests