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

ffmpeg-omx #82

Closed
drewcovi opened this issue Mar 14, 2018 · 53 comments
Closed

ffmpeg-omx #82

drewcovi opened this issue Mar 14, 2018 · 53 comments
Labels

Comments

@drewcovi
Copy link

https://github.com/legotheboss/homebridge-camera-ffmpeg-omx (and pretty much any camera plugin) would likely require ffmpeg.

Any chance this could get a pi release with this ffmpeg optimized for raspberry pi? https://github.com/legotheboss/YouTube-files/raw/master/ffmpeg_3.1.4-1_armhf.deb

@oznu
Copy link
Member

oznu commented Mar 14, 2018

I've not had success getting that to work. #62 (comment)

I didn't have a real rstp stream to test with, so it might work for you.

My docker-compose.yml:

  • Use debian stretch variant of this image
  • Pass-thru /dev/vchiq device
  • Privileged mode
version: '2'
services:
  homebridge:
    image: oznu/homebridge:debian-raspberry-pi
    restart: always
    network_mode: host
    privileged: true
    devices:
      - /dev/vchiq:/dev/vchiq
    volumes:
      - ./config:/homebridge
    environment:
      - PGID=1000
      - PUID=1000
      - HOMEBRIDGE_CONFIG_UI=1
      - HOMEBRIDGE_CONFIG_UI_PORT=8080
docker-compose up -d

Then edit the startup.sh file that gets created in the config directory.

You can also edit the startup.sh file using the config-ui-x plugin (Docker Menu Icon > Startup Script).

Add this to the bottom:

. /etc/os-release

if [ "$ID" = "debian" ]; then
  [ -f /homebridge/ffmpeg.deb ] || wget goo.gl/gMGA81 -O ffmpeg.deb
  [ -e /usr/local/bin/ffmpeg ] || dpkg -i ffmpeg.deb
  usermod -aG video abc
fi

Then restart the entire container

docker-compose restart homebridge

or in the config-ui-x plugin: Docker Menu Icon > Restart Container.

Then install the homebridge-camera-ffmpeg-omx plugin and configure as you normally would.


As I said, I have not been able to get this to work, but I suspect it may be because I was using a sample rstp stream I found on the internet. If this works for you please let me know.

@drewcovi
Copy link
Author

As a sanity check: is homebridge running as abc in the container? Or root?

@oznu
Copy link
Member

oznu commented Mar 14, 2018

Homebridge runs as abc. If you want to run it as root set the PGID and PUID variables to 0.

@drewcovi
Copy link
Author

yeah... it took me WAY too long to realize you had a debian-pi container... 😄

thanks for shepherding this newb. i definitely had it running outside a container before, so ill keep this thread updated.

@Itsmmai
Copy link

Itsmmai commented Mar 14, 2018

Hi, when I want to use ffmpeg on my version I run apk add --no-cache ffmpeg ffmpeg-libs. When I enable audio I receive the following error:

_ffmpeg version 3.4.2 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 6.4.0 (Alpine 6.4.0)
configuration: --prefix=/usr --enable-avresample --enable-avfilter --enable-gnutls --enable-gpl --enable-libass --enable-libmp3lame --enable-librtmp --enable-libvorbis --enable-libvpx --enable-libxvid --enable-libx264 --enable-libx265 --enable-libtheora --enable-libv4l2 --enable-postproc --enable-pic --enable-pthreads --enable-shared --enable-libxcb --disable-stripping --disable-static --enable-vaapi --enable-vdpau --enable-libopus --disable-debug

libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libavresample 3. 7. 0 / 3. 7. 0
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100

Guessed Channel Layout for Input Stream #0.1 : mono
Input #0, rtsp, from 'rtsp://wadmin:K315cool@192.168.0.195:4500/videoMain':
Metadata:

title           : IP Camera Video
comment         : videoMain

Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0: Video: h264 (Main), yuv420p(progressive), 1280x720, 90k tbr, 90k tbn, 180k tbc
Stream #0:1: Audio: pcm_mulaw, 8000 Hz, mono, s16, 64 kb/s

Unknown encoder 'libfdk_aac'

[2018-3-14 16:03:25] [Camera-ffmpeg] ERROR: FFmpeg exited with code 1_

Do you have a clue ?

thanks again,
Abel

@Jeff146
Copy link

Jeff146 commented Mar 20, 2018

I have the same issue as @Itsmmai

@oznu

Is there an easy way to enable lidfdk_aac, sorry I'm not really familiar with Linux., is there an easy way to add libfdk_acc and enable it in the conifg?

Thanks,
Jeff

@drewcovi
Copy link
Author

As a side note. Got this running in the container. So now I’m just trying out different plugins. The multi-stream seems promising.

@drewcovi
Copy link
Author

And yap. Definitely did not run the Alpine version. The Debian seems the best pick for raspberry pi. Don’t ask me why 😉

@oznu
Copy link
Member

oznu commented Mar 20, 2018

Good to hear you got it working @drewcovi. Were the instructions I posted above all that was required to get the omx version running?

@Itsmmai @Jeff146 - Your issue is different I think.

I've got a cheap Xiaomi camera enroute, once it arrives I'll be able to write up a definitive how-to guide on ffmpeg and this docker image.

@oznu
Copy link
Member

oznu commented Mar 20, 2018

@Jeff146 - The suggestion above won't work. ffmpeg needs to be compiled with aac support.

@Jeff146
Copy link

Jeff146 commented Mar 20, 2018

@oznu Ok thanks looking forward to it. I got the video to load but the audio I get the exit code of 1. I'm thinking because the docker image doesn't have libfdk_aac and it's not included in the ffmpeg and that's why it's not working for us.

@oznu
Copy link
Member

oznu commented Mar 20, 2018

Yeah, the homebridge-camera-ffmpeg repo says this:

To use audio ffmpeg must be compiled with --enable-libfdk-aac

Neither debian or alpine linux provide ffmpeg with this flag as part of their default repos.

@Jeff146
Copy link

Jeff146 commented Mar 20, 2018

I'm using the Docker with Synology and the Alpine Linux image, so is there an easy way to change it to enable libfdk-aac?

@oznu
Copy link
Member

oznu commented Mar 20, 2018

See #82 (comment)

@Itsmmai
Copy link

Itsmmai commented Mar 20, 2018

Nope, not for me.

schermafbeelding 2018-03-20 om 18 06 20

same error.

@Jeff146
Copy link

Jeff146 commented Mar 20, 2018

@oznu that worked for me, now I just have to adjust to optimize the packet size, is there a recommended one to try, I tried 188 and it seems to be better for the video but audio still a little choppy

@Itsmmai
Copy link

Itsmmai commented Mar 20, 2018 via email

@Jeff146
Copy link

Jeff146 commented Mar 20, 2018

@Itsmmai I have a Foscam FI9816 and the plug-in is homebridge-camera-ffmpeg

@oznu
Copy link
Member

oznu commented Mar 21, 2018

@Itsmmai - if you run ffmpeg inside the container, what is the output?

If you're still using homebridge-config-ui-x you can access the container terminal by clicking Docker Menu > Terminal.

If the --enable-libfdk-aac flag is not show please try running these two command again manually:

apk del ffmpeg ffmpeg-libs
apk --allow-untrusted add --no-cache --repository http://alpine.dl.oz.nu/ffmpeg ffmpeg ffmpeg-libs

Make sure you're running the latest version of this image as well, the update I pushed 10 days ago fixed some issues installing ffmpeg.

@Itsmmai
Copy link

Itsmmai commented Mar 25, 2018

Reloading the latest docker file did the trick. So now it works. My only problem now is that the recordings/video are not smooth and stops after a couple of seconds. But that is not your problem :-)

@1043717432
Copy link

@oznu Hi, I've used your compiled address to run successfully in the docker container homebridge sh command. Do I want to install homebridge-camera-ffmpeg-omx or homebridge-camera-ffmpeg again next, do you need to install the 2 plug-ins?

@oznu
Copy link
Member

oznu commented Apr 20, 2018

Hi @1043717432 ,

The homebridge-camera-ffmpeg plugin seems to do everything the homebridge-camera-ffmpeg-omx version does just by setting the vcodec to h264_omx.

From the readme:

vcodec If you're running on a RPi with the omx version of ffmpeg installed, you can change to the hardware accelerated video codec with this option, default "libx264"

https://github.com/KhaosT/homebridge-camera-ffmpeg

I would start by just trying to get the homebridge-camera-ffmpeg plugin working as it's well maintained.

@balboah
Copy link

balboah commented May 5, 2018

Did you guys manage to build the ffmpeg with omx on alpine or only use the debian package from someone else?

This is what I got so far:

FROM oznu/homebridge:raspberry-pi

RUN apk --update add build-base automake autoconf libtool
RUN curl -s https://codeload.github.com/felipec/libomxil-bellagio/tar.gz/0.9.1 \
  | tar xz -C /tmp/
RUN cd /tmp/libomxil-bellagio-0.9.1 \
  && autoreconf -i \
  && ./configure \
  && make && make install

RUN curl -Ls https://github.com/FFmpeg/FFmpeg/archive/n4.0.tar.gz \
  | tar xz -C /tmp/
RUN cd /tmp/FFmpeg* \
  && ./configure --arch=armel --target-os=linux --enable-gpl --enable-omx --enable-omx-rpi --enable-nonfree \
  && make -j4 && make install

Which will fail:

CC	libavcodec/omx.o
libavcodec/omx.c: In function 'omx_encode_init':
libavcodec/omx.c:689:34: error: 'OMX_BUFFERFLAG_CODECCONFIG' undeclared (first use in this function)
             if (buffer->nFlags & OMX_BUFFERFLAG_CODECCONFIG) {
                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~
libavcodec/omx.c:689:34: note: each undeclared identifier is reported only once for each function it appears in
libavcodec/omx.c: In function 'omx_encode_frame':
libavcodec/omx.c:840:30: error: 'OMX_BUFFERFLAG_CODECCONFIG' undeclared (first use in this function)
         if (buffer->nFlags & OMX_BUFFERFLAG_CODECCONFIG && avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~
CC	libavcodec/on2avc.o
make: *** [ffbuild/common.mak:60: libavcodec/omx.o] Error 1

@oznu
Copy link
Member

oznu commented May 12, 2018

I'd like to eventually include a build of ffmpeg that includes --enable-libfdk-aac for all architectures and --enable-omx --enable-omx-rpi for arm builds. The problem I currently face is the lack of any free continuous integration providers with native aarch64 support.

The current arm builds are done using Travis CI + QEMU and are already getting very close to 50 minute maximum job runtime allowed (QEMU is slow). Adding ffmpeg to the build would more than certainly push this over that limit causing the jobs to fail.

@jeylites
Copy link

jeylites commented May 17, 2018

which is a better setup to run FFmpeg, Alpine or Debian container?

FFmpeg or FFmpeg OMX?

Currently have FFmpeg setup in an Alpine container, very slow on RPI3... #42

@oznu
Copy link
Member

oznu commented May 18, 2018

ffmpeg with omx should speed things up when running on a rPI. Operating system shouldn't matter. I haven't tested if this works in practice inside the docker container yet.

@jeylites
Copy link

jeylites commented May 22, 2018

@oznu

I manage to follow your instructions and got it working on a Debian build container in a Raspberry Pi3. The still stream works with an update at every 12 seconds, however, live streaming doesn't.

Homebridge Config

{
    "bridge": {
        "name": "Homecamera#1",
        "username": "##:##:##:##:##:##",
        "port": #####,
        "pin": "031-45-###"
    },
    "description": "",
    "platforms": [
        {
            "platform": "Camera-ffmpeg-omx",
            "cameras": [
                {
                    "name": "STREET PTZ",
                    "button": true,
                    "throttle": 3000,
                    "videoConfig": {
                        "source": "-re -i rtsp://admin:5555@192.168.0.8:554//h264Preview_01_main",
                        "stillImageSource": "-i http://192.168.0.8/cgi-bin/api.cgi?cmd=Snap&channel=0&rs=abcd123456&user=admin&password=5555",
                        "maxStreams": 2,
                        "maxWidth": 640,
                        "maxHeight": 480,
                        "maxFPS": 30,
                        "vcodec": "h264_omx",
                        "packetSize": 188,
                        "debug": true
                    }
                }
            ]
        }
    ],
    "accessories": []
}

DOCKER YMAL

version: '2'
services:
  homebridge:
    image: oznu/homebridge:raspberry-pi
    restart: always
    network_mode: host
    volumes:
      - ./config:/homebridge
    environment:
      - PGID=1000
      - PUID=1000
      - HOMEBRIDGE_CONFIG_UI=1
      - HOMEBRIDGE_CONFIG_UI_PORT=8090
  homecamera:
    image: oznu/homebridge:debian-raspberry-pi
    restart: always
    network_mode: host
    privileged: true
    devices:
      - /dev/vchiq:/dev/vchiq
    volumes:
      - ./config-camera:/homebridge
    environment:
      - PGID=1000
      - PUID=1000
      - HOMEBRIDGE_CONFIG_UI=1
      - HOMEBRIDGE_CONFIG_UI_PORT=8091

LOG FILES

[2018-5-22 17:13:29] Homebridge is running on port 51827.
[2018-5-22 17:13:29] STREET PTZ is running on port 43759.
-re -i rtsp://admin:5555@192.168.0.8:554//h264Preview_01_main -threads 0 -vcodec h264_omx -an -pix_fmt yuv420p -r 10 -f rawvideo -tunezerolatency -vf scale=640:360 -b:v 132k -bufsize 132k -payload_type 99 -ssrc 1 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params VZe+iD5x6+lipZ7vjxVCqipHW9R+PgjpikB2QvZf srtp://192.168.0.16:49531?rtcpport=49531&localrtcpport=49531&pkt_size=1378
-re -i rtsp://admin:5555@192.168.0.8:554//h264Preview_01_main -threads 0 -vcodec h264_omx -an -pix_fmt yuv420p -r 10 -f rawvideo -tunezerolatency -vf scale=640:360 -b:v 132k -bufsize 132k -payload_type 99 -ssrc 1 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params +vE5US0VLJ1KTNUKO0rq1K/v46vMHF7JQOZYPE3t srtp://192.168.0.16:54373?rtcpport=54373&localrtcpport=54373&pkt_size=1378
-re -i rtsp://admin:5555@192.168.0.8:554//h264Preview_01_main -threads 0 -vcodec h264_omx -an -pix_fmt yuv420p -r 10 -f rawvideo -tunezerolatency -vf scale=640:360 -b:v 132k -bufsize 132k -payload_type 99 -ssrc 1 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params 2fQ1tMXUdfLkvITcNpI+MRxgLtyLL90VwlYDQEe8 srtp://192.168.0.16:63461?rtcpport=63461&localrtcpport=63461&pkt_size=1378
-re -i rtsp://admin:5555@192.168.0.8:554//h264Preview_01_main -threads 0 -vcodec h264_omx -an -pix_fmt yuv420p -r 10 -f rawvideo -tunezerolatency -vf scale=640:360 -b:v 132k -bufsize 132k -payload_type 99 -ssrc 1 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params ca8HtsJBRd9wJLZ1qKqmCDyUIYRXAQzvCAdj70If srtp://192.168.0.16:51567?rtcpport=51567&localrtcpport=51567&pkt_size=1378
-re -i rtsp://admin:5555@192.168.0.8:554//h264Preview_01_main -threads 0 -vcodec h264_omx -an -pix_fmt yuv420p -r 10 -f rawvideo -tunezerolatency -vf scale=640:360 -b:v 132k -bufsize 132k -payload_type 99 -ssrc 1 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params N+TLBJji7MGxPr3fMnHp8gPBuenUFWO+huDKT/KY srtp://192.168.0.16:60345?rtcpport=60345&localrtcpport=60345&pkt_size=1378
-re -i rtsp://admin:5555@192.168.0.8:554//h264Preview_01_main -threads 0 -vcodec h264_omx -an -pix_fmt yuv420p -r 10 -f rawvideo -tunezerolatency -vf scale=640:360 -b:v 132k -bufsize 132k -payload_type 99 -ssrc 1 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params Oy+mQD2egd9Ptn717qwg1giigY9DlRgSwvouO8B5 srtp://192.168.0.16:51114?rtcpport=51114&localrtcpport=51114&pkt_size=1378
-re -i rtsp://admin:5555@192.168.0.8:554//h264Preview_01_main -threads 0 -vcodec h264_omx -an -pix_fmt yuv420p -r 10 -f rawvideo -tunezerolatency -vf scale=640:360 -b:v 132k -bufsize 132k -payload_type 99 -ssrc 1 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params MkcPdk5IJB2uamaWkOsiKzlQmswyE2sN2QUE9RcT srtp://192.168.0.16:60209?rtcpport=60209&localrtcpport=60209&pkt_size=1378
-re -i rtsp://admin:5555@192.168.0.8:554//h264Preview_01_main -threads 0 -vcodec h264_omx -an -pix_fmt yuv420p -r 10 -f rawvideo -tunezerolatency -vf scale=640:360 -b:v 132k -bufsize 132k -payload_type 99 -ssrc 1 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params LBSxOahulxHKXaslnPkz+DmC6p+ZYJs0LoEc1yuJ srtp://192.168.0.16:58013?rtcpport=58013&localrtcpport=58013&pkt_size=1378

@oznu
Copy link
Member

oznu commented May 23, 2018

I got a camera to test this with a month or two back.

I have spent many hours compiling ffmpeg on a rPi 3 with the different options, including --enable-omx --enable-omx-rpi, none of these seem help the performance of the stream when running inside the docker container. As @jeylites mentioned, live steaming won't work at all when trying to use the h264_omx vcodec.

I think the solution here is, if you need omx support, then you'll need to run homebridge natively.

@oznu oznu closed this as completed May 23, 2018
@balboah
Copy link

balboah commented May 23, 2018

running inside or outside of docker doesn't make a difference. You can run with h264_omx codec, I had problems with ffmpeg not finding keyframes which was fixed with something like:

v4l2-ctl --set-ctrl=h264_i_frame_period=1
v4l2-ctl --set-ctrl=repeat_sequence_header=1

Tricky part for me was to be able to compile it for alpine, and a solution for not having to run with privileged permissions (in kubernetes)

@jeylites
Copy link

@balboah

How do you go about doing your way? I don’t mind trying since I have the rig setup up.

Just wondering, has anyone tried the VLC approach, replacement to ffmpeg?

@Jeff146
Copy link

Jeff146 commented May 23, 2018

Was wondering if the ffmpeg package changed? I suddenly have the same issue, I made sure I was on the lastest docker and ran the commands and the same issue. Anyone else have issues?

@balboah
Copy link

balboah commented May 23, 2018

@jeylites see my previous comment if you mean how I was trying to build it for alpine

@jeylites
Copy link

jeylites commented May 30, 2018

@balboah
sorry for the noob question...I'm not sure what I should be doing here, appreciate if you explain a little in-depth as I'm not very experienced in this regards :)

@oznu
After testing the docker ffmpeg setup and I was unable to get the stream to work so I decided to move back to homebridge natively compiled. Everything worked until I had "systemd" going. The stream couldn't be reached after "systemd" enabled, It wroked right after disabling it.

I'm not sure if your docker build is using "systemd" but if you have some time to verify the findings, it will be a great leap.

On another note, Snapshot refreshes every 11seconds on a docker build, while 60 seconds on homebridge native on cell network.

On wifi 10-11 sec for both build...

@LiroyvH
Copy link

LiroyvH commented Feb 15, 2019

@oznu Was that package changed by any chance? I've removed and installed it as instructed, but it still doesn't show it as having --enable-libfdk-aac in the flags. (Running in alpine docker)

@LiroyvH
Copy link

LiroyvH commented Mar 29, 2019

After a lot of messing around as all pre-build packages don't support fdk-aac (libaac), and the package linked above doesn't work either unfortunately, I manually compiled with the following commands (first get the latest ffmpeg build from their site (https://www.ffmpeg.org/download.html) and unpack it in your alpine docker). It might be backwards or a stupid way of going about it, but I was toying around and this worked hehe. So for anyone who needs it to have audio support on their FFMPEG camera stream, here's the commands I ran from the unpacked ffmpeg folder:

apk add yasm gnutls gnutls-dev gcc lame lame-dev opus opus-dev libtheora libtheora-dev libass libass-dev libvorbis libvorbis-dev libvpx libvpx-dev x265 x265-dev x264 x264-dev xvidcore xvidcore-dev v4l-utils-libs libxcb libxcb-dev v4l-utils-dev libva libva-dev libvdpau libvdpau-dev
apk add fdk-aac fdk-aac-dev --update-cache --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ --allow-untrusted
./configure --prefix=/usr --enable-avresample --enable-avfilter --enable-gnutls --enable-gpl --enable-libass --enable-libmp3lame --enable-libvorbis --enable-libvpx --enable-libxvid --enable-libx264 --enable-libx265 --enable-libtheora --enable-libv4l2 --enable-postproc --enable-pic --enable-pthreads --enable-shared --enable-libxcb --disable-stripping --disable-static --disable-librtmp --enable-vaapi --enable-vdpau --enable-libopus --disable-debug --enable-libfdk-aac --enable-nonfree
make
make install

And there you have it, audio can now be set to true.

@nicholasrobinson
Copy link

nicholasrobinson commented Sep 1, 2019

I was encountering this issue myself, running an alpine docker-homebridge based image on Synology. To resolve the issue I built a new docker image based on oznu/docker-homebridge with FFmpeg copied from alfg/ffmpeg.

See https://hub.docker.com/r/nicholasrobinson/ffmpeg-homebridge or https://www.github.com/nicholasrobinson/ffmpeg-homebridge for more details. To get the fix on Synology, just stop your existing homebridge container and replace it with nicholasrobinson/ffmpeg-homebridge.

@mrdc
Copy link

mrdc commented Nov 23, 2019

@oznu

I've got a cheap Xiaomi camera enroute, once it arrives I'll be able to write up a definitive how-to guide on ffmpeg and this docker image.

I have spent many hours compiling ffmpeg on a rPi 3 with the different options, including --enable-omx --enable-omx-rpi, none of these seem help the performance of the stream when running inside the docker container. As @jeylites mentioned, live steaming won't work at all when trying to use the h264_omx vcodec.

I think the solution here is, if you need omx support, then you'll need to run homebridge natively.

There is a good working solution to run ffmpeg in Docker with almost no performance impact - use stream copy without re-encoding (Xiaomi streams in H264, so can be easily viewed on Apple devices without it):
homebridge-plugins/homebridge-camera-ffmpeg#390

@mrdc
Copy link

mrdc commented Nov 24, 2019

Alternatively you can use the version I just compiled:

Will you be so kind to provide the updated version of ffmpeg with aac support?

@jeylites
Copy link

@mrdc

I would like to try out your version. Can you please send me the instruction link? Thank you.

@mrdc
Copy link

mrdc commented Nov 27, 2019

@mrdc

I would like to try out your version. Can you please send me the instruction link? Thank you.

Everything in this topic.

apk add ffmpeg

@black01gt
Copy link

black01gt commented Jan 11, 2020

Was anyone able to get aac working?

@Itsmmai
Copy link

Itsmmai commented Jan 12, 2020 via email

@black01gt
Copy link

@Itsmmai - if you run ffmpeg inside the container, what is the output?

If you're still using homebridge-config-ui-x you can access the container terminal by clicking Docker Menu > Terminal.

If the --enable-libfdk-aac flag is not show please try running these two command again manually:

apk del ffmpeg ffmpeg-libs
apk --allow-untrusted add --no-cache --repository http://alpine.dl.oz.nu/ffmpeg ffmpeg ffmpeg-libs

Make sure you're running the latest version of this image as well, the update I pushed 10 days ago fixed some issues installing ffmpeg.

I tried these steps but am not getting --enable-libfdk-aac

@Itsmmai
Copy link

Itsmmai commented Jan 14, 2020 via email

@black01gt
Copy link

After a lot of messing around as all pre-build packages don't support fdk-aac (libaac), and the package linked above doesn't work either unfortunately, I manually compiled with the following commands (first get the latest ffmpeg build from their site and unpack it in your alpine docker). It might be backwards or a stupid way of going about it, but I was toying around and this worked hehe. So for anyone who needs it to have audio support on their FFMPEG camera stream, here's the commands I ran from the unpacked ffmpeg folder:

apk add yasm gnutls gnutls-dev gcc lame lame-dev opus opus-dev libtheora libtheora-dev libass libass-dev libvorbis libvorbis-dev libvpx libvpx-dev x265 x265-dev x264 x264-dev xvidcore xvidcore-dev v4l-utils-libs libxcb libxcb-dev v4l-utils-dev libva libva-dev libvdpau libvdpau-dev
apk add fdk-aac fdk-aac-dev --update-cache --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ --allow-untrusted
./configure --prefix=/usr --enable-avresample --enable-avfilter --enable-gnutls --enable-gpl --enable-libass --enable-libmp3lame --enable-libvorbis --enable-libvpx --enable-l
ibxvid --enable-libx264 --enable-libx265 --enable-libtheora --enable-libv4l2 --enable-postproc --enable-pic --enable-pthreads --enable-shared --enable-libxcb --disable-stripping 
--disable-static --disable-librtmp --enable-vaapi --enable-vdpau --enable-libopus --disable-debug --enable-libfdk-aac --enable-nonfree
make
make install

And there you have it, audio can now be set to true.

Thanks this worked for me.

@Itsmmai
Copy link

Itsmmai commented Jan 14, 2020 via email

@jocamero
Copy link

This worked for me. Thank you!!

Note: careful with the copy/paste of the super long ./configure command; it's one command with a lot of arguments, not multiple commands.

apk add yasm gnutls gnutls-dev gcc lame lame-dev opus opus-dev libtheora libtheora-dev libass libass-dev libvorbis libvorbis-dev libvpx libvpx-dev x265 x265-dev x264 x264-dev xvidcore xvidcore-dev v4l-utils-libs libxcb libxcb-dev v4l-utils-dev libva libva-dev libvdpau libvdpau-dev
apk add fdk-aac fdk-aac-dev --update-cache --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ --allow-untrusted
./configure --prefix=/usr --enable-avresample --enable-avfilter --enable-gnutls --enable-gpl --enable-libass --enable-libmp3lame --enable-libvorbis --enable-libvpx --enable-libxvid --enable-libx264 --enable-libx265 --enable-libtheora --enable-libv4l2 --enable-postproc --enable-pic --enable-pthreads --enable-shared --enable-libxcb --disable-stripping --disable-static --disable-librtmp --enable-vaapi --enable-vdpau --enable-libopus --disable-debug --enable-libfdk-aac --enable-nonfree
make
make install

And there you have it, audio can now be set to true.

@Itsmmai
Copy link

Itsmmai commented Feb 1, 2020 via email

@mikesalz
Copy link

mikesalz commented Feb 5, 2020

@Jeff146, it would require compiling it yourself. On a low powered synology unit that could take a while.

Alternatively you can use the version I just compiled:

apk del ffmpeg ffmpeg-libs
apk --allow-untrusted add --no-cache --repository http://alpine.dl.oz.nu/ffmpeg ffmpeg ffmpeg-libs

Can you let me know if that works?

This version is identical to the official version but compiled with the --enable-libfdk-aac and --enable-omx-rpi (armhf version only) flags.

@oznu I am getting the following error. Is the repository still available?
WARNING: Ignoring http://alpine.dl.oz.nu/ffmpeg/x86_64/APKINDEX.tar.gz: DNS lookup error

@Itsmmai
Copy link

Itsmmai commented Feb 9, 2020

@Jeff146, it would require compiling it yourself. On a low powered synology unit that could take a while.
Alternatively you can use the version I just compiled:

apk del ffmpeg ffmpeg-libs
apk --allow-untrusted add --no-cache --repository http://alpine.dl.oz.nu/ffmpeg ffmpeg ffmpeg-libs

Can you let me know if that works?
This version is identical to the official version but compiled with the --enable-libfdk-aac and --enable-omx-rpi (armhf version only) flags.

@oznu I am getting the following error. Is the repository still available?
WARNING: Ignoring http://alpine.dl.oz.nu/ffmpeg/x86_64/APKINDEX.tar.gz: DNS lookup error

Sorry doesn't work for me but maybe because I'm on a NUC and not on a PI ?

@oznu oznu added the ffmpeg label Feb 18, 2020
@oznu
Copy link
Member

oznu commented Feb 18, 2020

Good news.

ffmpeg, with libfdk-aac audio support, is now included in this image.

@Itsmmai
Copy link

Itsmmai commented Feb 19, 2020

Good news.

ffmpeg, with libfdk-aac audio support, is now included in this image.

That is great but what if it still isn't working :-( ... I'm using a Intel NUC and the ozone docker :-(

@LiroyvH
Copy link

LiroyvH commented Apr 4, 2020

@Itsmmai It won't be able to find configure if you haven't downloaded ffmpeg yet.
The commands I posted in #82 (comment) assume you have downloaded and unpacked the ffmpeg source from their website first. So get https://ffmpeg.org/releases/ffmpeg-4.2.2.tar.bz2 (or whatever the latest version is on their website) then unpack it, open the folder and then you can run all the commands posted in my comment and it should build. No idea if it works on NUC/ozone, but you can give it a spin.

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

No branches or pull requests