VoCore2 + ffmpeg + h.264 encoding?

GinDiamond
 
Posts: 48
Joined: Thu Mar 31, 2016 11:02 pm

VoCore2 + ffmpeg + h.264 encoding?

Mon Jan 02, 2017 10:48 pm

Just for fun, I decided to see if ffmpeg would install on my vocore2. It did!

At first I tried to stream a file to an mp4 file using hevc, but that didn't work. I didn't really expect it to.

Code: Select all
ffmpeg -i {input}.mov -vcodec h264 -acodec aac -strict -2 {output}.mp4


I then tried to do the same but use h264 instead. The output got farther than the h265 one, but it stopped and said "No option h264".

Does ffmpeg for the vocore2 actually have the options available to stream to video files? If so, what kind?

And is it possible for one to rebuild ffmpeg for the vocore2 to at least allow h264 encoding?

noblepepper
 
Posts: 240
Joined: Sat Nov 29, 2014 3:22 pm

Re: VoCore2 + ffmpeg + h.264 encoding?

Mon Jan 02, 2017 11:11 pm

You'll need find the makefile for the package to see what options it is built with.

If ffmpeg uses a configure script it should be trivial to change the options.

GinDiamond
 
Posts: 48
Joined: Thu Mar 31, 2016 11:02 pm

Re: VoCore2 + ffmpeg + h.264 encoding?

Tue Jan 03, 2017 1:32 am

I know that this is very trivial to linux savvy people, but I can't for the life of me figure out how to build ffmpeg.ipk which I will then send to the vocore2 and install there. I would ideally like to build the ipk so I don't have to reflash the vocore.

I'm following this guide as a rule thing:

[url]
https://wiki.openwrt.org/doc/howtobuild/single.package
[/url]

Everything seems to build just fine (ffmpeg and all), but I can't for the life of me find where the ipk file is.

I've cloned the openwrt chaos calmer 15.05.1 and done make menuconfig and set it up for the VoCore2 and all.

/home/username/openwrt_chaoscalmer

is the cloned directory and where all building/compiling happens.

I found the ffmpeg config and makefile and changed the options to do h264 encoding.

Where is that darned ipk?

noblepepper
 
Posts: 240
Joined: Sat Nov 29, 2014 3:22 pm

Re: VoCore2 + ffmpeg + h.264 encoding?

Tue Jan 03, 2017 2:43 am

I've cloned the openwrt chaos calmer 15.05.1 and done make menuconfig and set it up for the VoCore2 and all.

From where? The official OpenWrt repo, Vonger's repo, my repo?

All have their caveats. I don't think you'll find any VoCore2 targets in the official repo. Vonger's repo could be considered the authoritative source but it hasn't been updated since the end of September and it is obvious he has made changes but hasn't updated github. Mine matched Vonger's at the time he last updated but I have made changes since then and there are some missing features but you can see what I have done until late December.

I'm following this guide as a rule thing:

[url]
https://wiki.openwrt.org/doc/howtobuild/single.package
[/url]
...
Where is that darned ipk?

Never used that guide, haven't seen it to my recollection. If it builds a package the location should be in the guide. It may just build an executable.

If you built a full openwrt image then the packages will be in a subdirectory of the bin directory. I don't have a chaos calmer build handy but on Lede this tells me where it is:
Code: Select all
$ find bin -name ffmpeg*
bin/packages/mipsel_24kc/packages/ffmpeg_2.8.8-2_mipsel_24kc.ipk

If you run the find command above from your buildroot base directory it will tell you where it is.

GinDiamond
 
Posts: 48
Joined: Thu Mar 31, 2016 11:02 pm

Re: VoCore2 + ffmpeg + h.264 encoding?

Tue Jan 03, 2017 1:04 pm

Thanks so much!

I've figured it out (sort of)

I have been using the official vocore repo (the one explicitly stated in the wiki for the vocore2. If I'm understanding correctly, building using the "real" openwrt chaos calmer will get you a .bin file, but it won't really work with the vocore2)

I'll see if I can't use that searching command for the ipk. I DID get the ipk by rebuilding the entire image and looking in the bin folder. There I found the new ffmpeg stuff. Of course, its been taking several tweaks (I'm fairly new at changing make files, but I am very confident that I'll get this working correctly. I now know what I need to change, and as you've said, its really not too difficult.)

I'm headed to work today, so I'll just push my openwrt directory to my server, grab it at work, and continue tweaking as I can.

I'll post the results!

GinDiamond
 
Posts: 48
Joined: Thu Mar 31, 2016 11:02 pm

Re: VoCore2 + ffmpeg + h.264 encoding?

Tue Jan 03, 2017 4:03 pm

So I added

--enable libx264

to the makefile in the right part.

HOWEVER

I am now getting a compiling error:

Code: Select all
Applying ./patches/050-Correctly_map_multichannel_ADTS-AAC.patch using plaintext:
patching file libavcodec/aacdec.c
touch /home/bench/openwrt-chaoscalmer/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/ffmpeg-full/ffmpeg-2.6.9/.prepared_8ddd0e3fb6d71f7cd4fbac7edc9db269
rm -f /home/bench/openwrt-chaoscalmer/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/stamp/.ffmpeg.full_installed
( cd /home/bench/openwrt-chaoscalmer/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/ffmpeg-full/ffmpeg-2.6.9; CFLAGS="-Os -pipe -mno-branch-likely -mips32r2 -mtune=24kec -mdsp -fno-caller-saves -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -I/home/bench/openwrt-chaoscalmer/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/usr/include -I/home/bench/openwrt-chaoscalmer/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/include -I/home/bench/openwrt-chaoscalmer/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/usr/include -I/home/bench/openwrt-chaoscalmer/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/include -fpic" LDFLAGS="-L/home/bench/openwrt-chaoscalmer/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/usr/lib -L/home/bench/openwrt-chaoscalmer/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/lib -L/home/bench/openwrt-chaoscalmer/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/usr/lib -L/home/bench/openwrt-chaoscalmer/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/lib" ./configure --enable-cross-compile --cross-prefix="mipsel-openwrt-linux-uclibc-" --arch="mipsel" --target-os=linux --prefix="/usr" --pkg-config="pkg-config" --enable-shared --enable-static --enable-small --enable-pthreads --enable-zlib --enable-libx264 --disable-runtime-cpudetect --disable-doc --disable-debug --enable-gpl --enable-version3 --disable-altivec --disable-amd3dnow --disable-amd3dnowext --disable-mmx --disable-mmxext --disable-sse --disable-sse2 --disable-sse3 --disable-ssse3 --disable-sse4 --disable-sse42 --disable-avx --disable-xop --disable-fma3 --disable-fma4 --disable-avx2 --disable-vfp --disable-neon --disable-inline-asm --disable-yasm --enable-mips32r2 --disable-mipsdspr1 --disable-mipsdspr2 --disable-mipsfpu --disable-dxva2 --disable-lzma --disable-vaapi --disable-vda --disable-vdpau --disable-outdevs )
ERROR: libx264 not found


As I can figure, libx264 is not installed

But when I do sudo apt-get install libx264-dev, it says its already installed on my machine.

How do I compile ffmpeg + h264 for the vocore?

noblepepper
 
Posts: 240
Joined: Sat Nov 29, 2014 3:22 pm

Re: VoCore2 + ffmpeg + h.264 encoding?

Tue Jan 03, 2017 5:27 pm

Repo Information:

The official OpenWrt or Lede repos won't even give you an option to compile for VoCore2, the best you could do is another mt7628 device and most have some important differences. I hope to submit VoCore2 support to Lede this week, then move on to OpenWrt trunk and the backport to Chaos Calmer.

Vongers (the one you are using) started with my repo which added my mods to get the console on working on the right port and a few other things. He added his sound drivers and it looks like his github repo hasn't been updated since then. It is obvious his images (.bin files) have changes since then. So you get a base to start from that is where Vonger was Sept 1

My repo was the same as Vonger's on Sept 1 but I have made changes since then so it will be different from the images from VoCore. The main differences are I set up Vonger's sound drivers to produce an opkg package and add some target images for different variants of the VoCore2, Vonger is going with a general purpose one size fits all image. I haven't updated my repo since I got production hardware (I still haven't received my Ultimate) and I know of a couple of problems with the images my repo produces, nothing horrible but they aren't "right" yet.

So there really isn't a fantastic place to get sources. Of course I like mine, but until I fix some things it is hard to recommend for someone else. I think it may be the best place to start since it is more up to date than Vonger's, at least until he updates his repo.

Open source software is an exercise in semi-controlled chaos and friendly plagiarism, have fun!

noblepepper
 
Posts: 240
Joined: Sat Nov 29, 2014 3:22 pm

Re: VoCore2 + ffmpeg + h.264 encoding?

Tue Jan 03, 2017 5:53 pm

FFMPEG information:

to the makefile in the right part.


It helps others help you if you tell us where you think the "right part" is. If you are successful it will help others that want to duplicate your work.

But when I do sudo apt-get install libx264-dev, it says its already installed on my machine.


OpenWrt lives in it's own little cross compiling world, other than having the tools to compile (gcc, make, things like that) it doesn't care what you have installed on your system.

There is an option for libx264 under libraries in the menuconfig. Two ways to go here:
1. You can just enable it and hope OpenWrt compiles it before ffmpeg, it may work, it may not work, and it may work today and not tomorrow. If you go this way the best shot is to disable ffmpeg, enable libx264, compile, enable ffmpeg, and compile again. This should make sure libx264 is ready when ffmpeg tries to build.

2. Setup a dependency for libx264 in the ffmpeg makefile. This is the "right" way to do it but it may not be "trivial".

The ffmpeg Makefile is one of the more complex I have run into, ffmpeg has a lot of options to set and OpenWrt has them set up in groups. It looks like you need to do something in the section at the top of the Makefile where all the FFMPEG_CUSTOM_WHATEVER definitions are and this will feed the part where the dependencies are setup

GinDiamond
 
Posts: 48
Joined: Thu Mar 31, 2016 11:02 pm

Re: VoCore2 + ffmpeg + h.264 encoding?

Wed Jan 04, 2017 12:07 am

I feel kind of stupid here.

I've tried enabling libx264 in the FFMPEG_CONFIGURE: section of the ffmpeg makefile. Trying to compile like this doesn't work.

I did make clean to clear everything out, and then I ran make menuconfig again. I can't find "libx264" in the Libraries of make menuconfig. I can find libffmpeg-full or libffmpeg-mini, but no h264.

What am I missing here? I'm almost positive that this should be easier than I'm making it out to be.

Again, I'm using vogner's openwrt repo

noblepepper
 
Posts: 240
Joined: Sat Nov 29, 2014 3:22 pm

Re: VoCore2 + ffmpeg + h.264 encoding?

Wed Jan 04, 2017 5:58 am

You can't find it because IT ISN'T THERE!

This is my bad, sorry. I am working on my Lede repo to get a pull request ready (hopefully in time for their first release) and I just checked in Lede.

This was added since the Chaos Calmer release and is only available in OpenWrt trunk and Lede. Both of those are development branches so they come with a may break at any time disclaimer. But even worse for VoCore2 users they use a new open source WiFi driver, I have gotten WiFi speeds from decent (maybe 1/2 of normal) to absolutely unusable depending on which board I load it on.

I just did a quick & dirty to add this to Chaos Calmer and kicked of a build, I'll let you know the results.

Think you feel stupid? Try telling someone to look for something that isn't there!

Next
Return to VoCore2/Lite/Ultimate

Who is online

Users browsing this forum: No registered users and 40 guests