Skip to content
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

Won't Build on Ubuntu 13.10 x64 #1461

Closed
lilyannehall opened this issue Jan 8, 2014 · 144 comments
Closed

Won't Build on Ubuntu 13.10 x64 #1461

lilyannehall opened this issue Jan 8, 2014 · 144 comments

Comments

@lilyannehall
Copy link

I have been trying for days to get Node-Webkit to build, so that I can create a custom version of libffmpegsumo.so to enable support for h.264 video.

I followed the instructions here in the wiki page several times. I had to modify the build_install_deps.sh, to allow me to run it on 13.10 since the version is not included in the supported list. This was fine, I just had to install some packages manually.

Syncing using gclient and ./build/gyp_chromium content/content.gyp both complete successfully.

I modify the the lines in build_ffmpeg.sh as you state in the wiki ...

add_flag_common --enable-decoder=aac,h264,mp3
add_flag_common --enable-demuxer=mp3,mov
add_flag_common --enable-parser=aac,h264,mpegaudio

Then I run the build using ninja:

ninja -C out/Release nw -j4

It does it's thing and get almost completely finished before it dies at:

cc1plus: all warnings being treated as errors
[9268/9901] CXX obj/content/browser/accessibil...ontent_browser.browser_accessibility_manager.o
ninja: build stopped: subcommand failed.

Now, even though I don't get the nw executable from this, it does in fact give me libffmpegsumo.so, so I figured I should be able to use this with the latest pre-built binary.

Nope. It behaves exactly as before. I tried numerous times with numerous different versions of Chrome and Chromium, just taking their copy of libffmpegsumo.so, but when I use theirs, my app simply crashes after about 2 seconds with no output.

This is a showstopper for me and it's extremely frustrating, because I have read the Node-Webkit documentation and the referenced Chromium documentation up and down to try and get this to work and I am at a complete loss. 😓

What am I missing? Or where can I acquire a proper working copy of libffmpegsumo.so for the lastest version of node-webkit that includes the GPL licensed h.264 and mp3 support?

Your help is very much appreciated!

@lilyannehall
Copy link
Author

I realized that I had not enabled the resource loader's support in src/net/base/mime_util.cc, so I went back through and added the proprietary codecs to the list of common codec (I assume this is what I'm supposed to do here):

// A list of media types: http://en.wikipedia.org/wiki/Internet_media_type
// A comprehensive mime type list: http://plugindoc.mozdev.org/winmime.php
// This set of codecs is supported by all variations of Chromium.
static const char* const common_media_types[] = {
  // Ogg.
  "audio/ogg",
  "application/ogg",
#if !defined(OS_ANDROID)  // Android doesn't support Ogg Theora.
  "video/ogg",
#endif

  // WebM.
  "video/webm",
  "audio/webm",

  // Wav.
  "audio/wav",
  "audio/x-wav",

  // MPEG-4.
  "video/mp4",
  "video/x-m4v",
  "audio/mp4",
  "audio/x-m4a",

  // MP3.
  "audio/mp3",
  "audio/x-mp3",
  "audio/mpeg",
};

...

// List of supported codecs when passed in with <source type="...">.
// This set of codecs is supported by all variations of Chromium.
//
// Refer to http://wiki.whatwg.org/wiki/Video_type_parameters#Browser_Support
// for more information.
//
// The codecs for WAV are integers as defined in Appendix A of RFC2361:
// http://tools.ietf.org/html/rfc2361
static const char* const common_media_codecs[] = {
#if !defined(OS_ANDROID)  // Android doesn't support Ogg Theora.
  "theora",
  "vp9",  // TODO(tomfinegan): Move vp9 back down with vp8 once VP9 is supported
          // on Android. https://crbug.com/285016
#endif
  "vorbis",
  "vp8",
  "1",  // WAVE_FORMAT_PCM.
  "avc1",
  "mp4a"
};

So, I (maybe incorrectly) assume this should give me what I want since I made the corresponding changes to build_ffmpeg.sh. But still, I always receive this error:

[9268/9901] CXX obj/content/browser/accessibil...ontent_browser.browser_accessibility_manager.o
ninja: build stopped: subcommand failed.

Every time I try to build, without fail. Has anyone else experienced this?

@lilyannehall
Copy link
Author

also worth noting that i receive this error with or without modification to the source.

... sorry for the comment barrage.

@lilyannehall
Copy link
Author

Update:
I was able to get a successful build after disabling the -Werror flag in /src/build/common.gypi on line 2768.

From

# Enable -Werror by default, but put it in a variable so it can
# be disabled in ~/.gyp/include.gypi on the valgrind builders.
  'variables': {
    'werror%': '-Werror',
    'libraries_for_target%': '',
}

...to...

# Enable -Werror by default, but put it in a variable so it can
# be disabled in ~/.gyp/include.gypi on the valgrind builders.
  'variables': {
    'werror%': '',
    'libraries_for_target%': '',
}

It successfully runs my application, but unfortunately I'm faced with still no playback of mp4 files. Now that I (somehow) have a successful build, I suppose I have missed something that needs to be adjusted differently.

I think I've reached a dead end here. 😒

@rogerwang
Copy link
Member

The instructions need to be updated: you need to patch the ffmpeg repo (or define the branding gyp variable to Chrome, didn't try it)

diff --git a/ffmpeg.gyp b/ffmpeg.gyp
index ac059f0..1b0424c 100644
--- a/ffmpeg.gyp
+++ b/ffmpeg.gyp
@@ -54,7 +54,7 @@
       ['chromeos == 1', {
         'ffmpeg_branding%': '<(branding)OS',
       }, {  # otherwise, assume Chrome/Chromium.
-        'ffmpeg_branding%': '<(branding)',
+        'ffmpeg_branding%': 'Chrome',
       }],
     ],

and follow Short Directions in README.chromium (might be optional)

@lilyannehall
Copy link
Author

@rogerwang thanks so much, I will give it a shot!

@kirkegaard
Copy link

@gordonwritescode Did you ever figure this one out? I have a build that will play h264 video but not aac audio. Im not sure if aac is something different or included in the mpeg4 codec?

@lilyannehall
Copy link
Author

@kirkegaard I never did get back around to aac support :( sorry

@xaiki
Copy link

xaiki commented May 1, 2014

it looks like you don't need to build all of chrome/chromium/node-webkit for this
you can ninja -C out/Release ffmpeg

I'm getting a lot smaller libffmpegsumo.so that seems to be lacking symbols from the Debian distributed one.

@ghost
Copy link

ghost commented May 2, 2014

@xaiki: The reason for this is that in recent commits to Chromium they have moved from using FFMpeg to decode AAC to a embedded AAC decoder; hence why there are so many symbols missing

@kirkegaard
Copy link

Oh so that might be the reason why i can get h264 to work but not aac, since its not in the ffmpegsumo file anymore? Would it be possible to update the library included in node-webkit so we at least can have aac support?

@ghost
Copy link

ghost commented May 2, 2014

@kirkegaard: I'm working on a full ffmpeg compile now for node-webkit. Should appear in a fork very soon.

@kirkegaard
Copy link

@xeoncore That would be amazing! Thank you!

@ghost
Copy link

ghost commented May 2, 2014

@kirkegaard: First comes porting in AAC, AC3 and H264/265. Once thats done and works, I'll move on to supporting some new containers like AVI. Theoretically Chrome already supports XviD because all XviD is is a MPEG4

@xaiki
Copy link

xaiki commented May 2, 2014

@xeoncore i'm working on the exact same thing !

@xaiki
Copy link

xaiki commented May 2, 2014

@ghost
Copy link

ghost commented May 3, 2014

@xaiki: If you want to test any of your builds @jduncanator reached out and said he'd help. So far he gave me this: http://us-chi.cdn.ptn.pm/nwtests/

Seems like a good place to start with unit-tests etc.

@ghost
Copy link

ghost commented May 3, 2014

#!/bin/bash
cd /path/to/node-webkit/src/third_party/ffmpeg
nano ./chromium/scripts/build_ffmpeg.sh
./chromium/scripts/build_ffmpeg.sh linux x64 `pwd`
./chromium/scripts/copy_config.sh
rm -fr build.ia32.linux/
cp -r build.x64.linux/ build.ia32.linux/
./chromium/scripts/generate_gyp.py
gclient runhooks

This seems to do the trick for me. Can compile FLAC and others in!

@smolleyes
Copy link

+1 like a dream if you can do it for all platforms 💃

@smolleyes
Copy link

need opus codec too :p

@xaiki
Copy link

xaiki commented May 3, 2014

Opus seems easy

@smolleyes
Copy link

for the moment i do live ffmpeg transcoding but it use a lot of cpu sometimes and boring for seeking and things like that ... :p

@ghost
Copy link

ghost commented May 4, 2014

@smolleyes I've got it working. Sadly it wasn't just a hack to ffmpeg (meaning I could just keep upto date a fork of ffmpeg). It involved a hack to chromium source code as well. For now I'll have to maintain both. Or maybe just a patch for Chrome's source

@xaiki
Copy link

xaiki commented May 4, 2014

Do you have your patch somewhere ?
We actually got some fairly good results without patching,.... It looks
like ordering is important though.

@ghost
Copy link

ghost commented May 4, 2014

@xaiki Patching is required for AC3 audio playback as it isn't a registered codec in the source of Chromium.

diff --git a/media/base/audio_decoder_config.h b/media/base/audio_decoder_config.h
index a17d221..5981f28 100644
--- a/media/base/audio_decoder_config.h
+++ b/media/base/audio_decoder_config.h
@@ -33,6 +33,7 @@ enum AudioCodec {
   kCodecPCM_S24BE,
   kCodecOpus,
   kCodecEAC3,
+  kCodecAC3,
   // DO NOT ADD RANDOM AUDIO CODECS!
   //
   // The only acceptable time to add a new codec is if there is production code
diff --git a/media/ffmpeg/ffmpeg_common.cc b/media/ffmpeg/ffmpeg_common.cc
index 1a45134..320e09a 100644
--- a/media/ffmpeg/ffmpeg_common.cc
+++ b/media/ffmpeg/ffmpeg_common.cc
@@ -89,6 +89,8 @@ static AudioCodec CodecIDToAudioCodec(AVCodecID codec_id) {
       return kCodecPCM_MULAW;
     case AV_CODEC_ID_OPUS:
       return kCodecOpus;
+    case AV_CODEC_ID_AC3:
+      return kCodecAC3;
     default:
       DVLOG(1) << "Unknown audio CodecID: " << codec_id;
   }
@@ -134,6 +136,8 @@ static AVCodecID AudioCodecToCodecID(AudioCodec audio_codec,
       return AV_CODEC_ID_PCM_MULAW;
     case kCodecOpus:
       return AV_CODEC_ID_OPUS;
+    case kCodecAC3:
+      return AV_CODEC_ID_AC3;
     default:
       DVLOG(1) << "Unknown AudioCodec: " << audio_codec;
   }

Doing that plus patching the build script of FFmpeg and you have a working AC3 decoder for node-webkit. You can obviously expand this to whatever codec you like.

@xaiki
Copy link

xaiki commented May 4, 2014

We got ac3 playing in mp4 without patching.
It didn't work in audio tags though.
Anyways, if you have a working patch I'd be delighted to see it !

@ghost
Copy link

ghost commented May 4, 2014

@xaiki How so? I've tried everything and anything short of patching, still couldn't get AC3 working.

@xaiki
Copy link

xaiki commented May 4, 2014

(I'm in a bus from the phone right now)
But basically:
Run the FFmpeg build script
Run the copy lib script
Manually copy the x64 folder to the ia32 one
Run generate_gyp
Run ninja on chromium.

@ghost
Copy link

ghost commented May 4, 2014

@xaiki Done all that (jduncanator told me about the copy x64 trick ;)) but still no AC3 unless you manually add the AC3 codec ID to Chrome source.

If you wish to test it I have a patched version uploaded here: https://mega.co.nz/#!woh0hJBC!ez8HoC-LS4kl6LYkT8b7UzZahYFX6dGGcPj743fB_-g

You can test it with any of the video files here that are labelled with "AC3" audio. It doesn't seem to support Opus but I'm working on that. Also supports FLAC. Enjoy!

@ghost
Copy link

ghost commented May 4, 2014

@smolleyes Once I have a Opus version working, I'll merge all my changes into my ffmpeg fork and release a guide on compiling and building a patched Node-webkit (along with binaries of course!)

@ghost
Copy link

ghost commented Sep 24, 2014

Don't use make, use ninja. make on Windows is so broken, Its not even worth your time!

@smolleyes
Copy link

@xeoncore

hi :)

humm my problem is with the

./chromium/scripts/build_ffmpeg.sh win ia32 pwd

don t think i can use ninja with it ...

don t understand the problem

@smolleyes
Copy link

hi :p

still trying !

so i reinstalled vs 2010 ultimate and cleaning everything before, ffmpeg config now works but won t build in cygwin

error:

License: LGPL version 2.1 or later
Creating config.mak, config.h, and doc/config.texi...
Building libavutil/avutil-52.dll for Chromium...
make -j4 libavutil/avutil-52.dll
CC libavutil/../compat/msvcrt/snprintf.o
cl : Command line warning D9002 : ignoring unknown option '/cygdrive/d/dev/chrom
ium-win/src/third_party/ffmpeg/libavutil/../compat/msvcrt/snprintf.c'
cl : Command line error D8003 : missing source filename
/cygdrive/d/dev/chromium-win/src/third_party/ffmpeg/common.mak:49: recipe for ta
rget 'libavutil/../compat/msvcrt/snprintf.o' failed
make: *** [libavutil/../compat/msvcrt/snprintf.o] Error 1

same code build on mingw actually... i ll try to continue

edit: same problem on generate content

Windows toolchain out of date or doesn't exist, updating (Express)...

it absolutely want to install 2013toolchain!!! (and it fail if i do) why does it not continue with 2010 .. !!!

@smolleyes
Copy link

ok it definitely stop will wait for a real doc on how to build node-webkit with precise tools to download/install (visual studio v???, yasm ???, c99 ?? etc etc) and where, how to launch cygwin or mingw etc etc on windows seven/eight... :(

let me know if i can help

(i HATE windows :p)

thanks

@gyzerok
Copy link

gyzerok commented Oct 4, 2014

@xeoncore Hello! Is there a way to contact to you about building node-webkit? Skype or something.

@smolleyes
Copy link

hello

still anyone on how to build step by step on win7 ? :D?

thx

@smolleyes
Copy link

trying to build ffmpeg on nw11 i have at the end of libffmpegsumo build i have

libffmpegsumo.so: version node not found for symbol av_fast_malloc at LIBAVCODEC_55

no idears why ?

@thesabbir
Copy link

@xeoncore do you have a fork of node-webkit with more codecs enabled ? Or at least an instruction would help a lot!

@lixiaohui
Copy link

linux ubuntu12.04 32bit compile nod-webkit 0.11.2
require: gcc-4.8 or higher (I test with gcc-4.8.3)
require: packages "./src/build/install-build-deps.sh" contains, except "lib32ncurses5-dev, lib32z1-dev", you can install these packages yourself manual with "apt-get install "command.
require: the "src/third_party/ffmpeg" needs the support of c++11 standard, you can comment the error lines, or add the compile flag of "std=gnu++11" in file "src/out/Release/build.ninja::line:command = $cxx ..." when compile with release version.
require: before run command "./build/gyp_chromium content/content.gyp", you should run "export GYP_DEFINES='clang=0' " to change the comiler to gcc.
then you can comile as the URL "https://github.com/rogerwang/node-webkit/wiki/Building-node-webkit" mentioned.

windows7 64bit compile node-webkit 0.11.2 32bit
require: vs2013 and update4
require: add " #pragma warning(disable: 4702)" in file "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xtree"
require: if there's some error about Unicode encoding, please change the python config file: "depot_tools\python276_bin\Lib\site.py::line: encoding = "ascii"" to "encoding = "cp1251"".
require : run command "set DEPOT_TOOLS_WIN_TOOLCHAIN=0", "set DEPOT_TOOLS_WIN_TOOLCHAIN=0", and "set GYP_MSVS_VERSION=2013" before command "python build\gyp_chromium content\content.gyp".
then you can compile as the URL "https://github.com/rogerwang/node-webkit/wiki/Building-node-webkit" mentioned.

windows7 64bit compile node-webkit 0.11.2 32bit add ffmpeg mp4 format support
require: cygwin on win7, if your cygwin version is not 'CYGWIN_NT-6.1' defined in file "src\third_party\ffmpeg\chromium\scripts\build_ffmpeg.py", please change the file "build_ffmpeg.py" to support your cygwin version. you can get your cygwin version in cygwin command line with " python ; import platform; platform.system()"
require: add "call "%VS120COMNTOOLS%vsvars32.bat" >NUL: " to your Cygwin.bat file, before the line : "bash --login -i".
then you can comiple as the URL:"https://github.com/rogerwang/node-webkit/wiki/Using-MP3-%26-MP4-%28H.264%29-using-the--video--%26--audio--tags."

@smolleyes
Copy link

hi

thanks for the comment lixiaohui

when i download sources with gclient and nw12 i don t have build_ffmpeg.sh do i have to use .py ?

@smolleyes
Copy link

ffmpeg seems ok with the .py i modified... im building nw now on linux x64

still searching howto setup the windows env exactly (cygwin..)

++

@smolleyes
Copy link

ok got everything working

nw build with hevc/dts/dtshd/flac/ac3/mp3/opus... only problem is avi with a small frame rate or don t know what is not fluid...

if someone know howto cross compile from ubuntu 64 to 32 with the same sources i m interested :)

thanks

@jduncanator
Copy link

@smolleyes you can't.

@smolleyes
Copy link

i m done with it by chroot...

got some difficulties with windows now (and again pfffffffffffffffff)

i m on pt channel on irc if you can help with it , might be cool

@smolleyes
Copy link

#3275

@jduncanator
Copy link

@smolleyes I'm sorry, I haven't touched the Chromium source in months. I never got anything building on Windows so I can't help.

@smolleyes
Copy link

ok thanks :) windows is boooooooooooooorrring :(

@smolleyes
Copy link

got my win32 build YEAAAHHH 💃

@imShara
Copy link

imShara commented Apr 19, 2015

How do you add audio tag codec support? After adding FLAC mimetype, file is defined as audio, but does not play.

# mime_util.cc

static const char* const common_media_types[] = {
  // Ogg.
  "audio/ogg",
  "application/ogg",
#if !defined(OS_ANDROID)  // Android doesn't support Ogg Theora.
  "video/ogg",
#endif

  // WebM.
  "video/webm",
  "audio/webm",

  // Wav.
  "audio/wav",
  "audio/x-wav",

  // FLAC.
  "audio/flac",
  "audio/x-flac",

#if defined(OS_ANDROID)
  // HLS. Supported by Android ICS and above.
  "application/vnd.apple.mpegurl",
  "application/x-mpegurl",
#endif
};

libffmpegsumo compiled with

# libffmpegsumo.py

configure_flags['Chrome'].extend([
    '--enable-decoder=aac,flac,mp3',
    '--enable-demuxer=aac,flac,mp3',
    '--enable-parser=aac,flac,mpegaudio',
])

@imShara
Copy link

imShara commented Apr 19, 2015

Selfanswer: FLAC works with CromeOS branding and added flac mimetype.

// src/net/base/mime_util.cc

static const char* const common_media_types[] = {
  // Ogg.
  "audio/ogg",
  "application/ogg",
#if !defined(OS_ANDROID)  // Android doesn't support Ogg Theora.
  "video/ogg",
#endif

  // WebM.
  "video/webm",
  "audio/webm",

  // Wav.
  "audio/wav",
  "audio/x-wav",

  // FLAC.
  "audio/flac",
  "audio/x-flac",

#if defined(OS_ANDROID)
  // HLS. Supported by Android ICS and above.
  "application/vnd.apple.mpegurl",
  "application/x-mpegurl",
#endif
};
# src/third_party/ffmpeg/ffmpeg.gyp

['chromeos == 1', {
  'ffmpeg_branding%': '<(branding)OS',
}, {  # otherwise, assume Chrome/Chromium.
  'ffmpeg_branding%': 'ChromeOS',
}],

But how to make custom codec list support still interesting

@smolleyes
Copy link

hi

i never touched to mime_util.cc ...

here are all the changes i made...

https://github.com/smolleyes/nw_ffmpeg

then i build with (exemple for linux x64)

./chromium/scripts/build_ffmpeg.py linux x64
./chromium/scripts/copy_config.sh
./chromium/scripts/generate_gyp.py
cd ../..
./build/gyp_chromium -D linux_dump_symbols=0 -D proprietary_codecs=1 content/content.gyp
ninja -C out/Release -j16 ffmpegsumo
ninja -C out/Release -j16

++

@imShara
Copy link

imShara commented Apr 20, 2015

i never touched to mime_util.cc ...

@smolleyes, did you add new extension? Without modify mime_util.cc, *.flac files opened with "save as" dialog, not as audio (like *.mp3).

Thanks for diff!

@jduncanator
Copy link

@imShara You need to serve them with correct headers, Content-Type: audio/flac

@imShara
Copy link

imShara commented Apr 20, 2015

@jduncanator, served with header Content-Type: audio/x-flac

xdg-mime query filetype "song.flac"

audio/x-flac

@jduncanator
Copy link

Try also adding "audio/x-flac" to the mime_utils.cc file.

@imShara
Copy link

imShara commented Apr 22, 2015

@jduncanator, why need? It works with "audio/flac" and "audio/x-flac" only in mime_utils.cc

@imShara
Copy link

imShara commented Apr 25, 2015

@jduncanator, you are right, audio/x-flac need in mime_utils.cc for correct working .canPlayType() audion tag function.

@jduncanator
Copy link

@imShara It depends on what Content-Type you serve it with. You could serve it with audio/poop so long as audio/poop was in mime_utils.cc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests