Hi Bio_TICFSL,
I tried follow your guide. But It's still not working. I tried install X264 and openh264.
- Install X264:
$ git clone https://code.videolan.org/videolan/x264.git
$ ./configure
$ make
$ make install
- Install Openh264
$ git clone GitHub - cisco/openh264: Open Source H.264 Codec
$ ./configure
$ make
$ make install
- I check "ffmpeg" command and get:
ffmpeg version 4.1.1 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 8.3.0 (GCC)
configuration: --disable-stripping --enable-pic --enable-shared --enable-pthreads --disable-libxcb --disable-libxcb-shm --disable-libxcb-xfixes --disable-libxcb-shape --cross-prefix=arm-poky-linux-gnueabi- --ld='arm-poky-linux-gnueabi-gcc -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a7 --sysroot=/home/toanrd/LastDistro/build-x11/tmp/work/cortexa7hf-neon-poky-linux-gnueabi/ffmpeg/4.1.1-r0/recipe-sysroot' --cc='arm-poky-linux-gnueabi-gcc -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a7 --sysroot=/home/toanrd/LastDistro/build-x11/tmp/work/cortexa7hf-neon-poky-linux-gnueabi/ffmpeg/4.1.1-r0/recipe-sysroot' --cxx='arm-poky-linux-gnueabi-g++ -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a7 --sysroot=/home/toanrd/LastDistro/build-x11/tmp/work/cortexa7hf-neon-poky-linux-gnueabi/ffmpeg/4.1.1-r0/recipe-sysroot' --arch=arm --target-os=linux --enable-cross-compile --extra-cflags=' -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=/home/toanrd/LastDistro/build-x11/tmp/work/cortexa7hf-neon-poky-linux-gnueabi/ffmpeg/4.1.1-r0=/usr/src/debug/ffmpeg/4.1.1-r0 -fdebug-prefix-map=/home/toanrd/LastDistro/build-x11/tmp/work/cortexa7hf-neon-poky-linux-gnueabi/ffmpeg/4.1.1-r0=/usr/src/debug/ffmpeg/4.1.1-r0 -fdebug-prefix-map=/home/toanrd/LastDistro/build-x11/tmp/work/cortexa7hf-neon-poky-linux-gnueabi/ffmpeg/4.1.1-r0/recipe-sysroot= -fdebug-prefix-map=/home/toanrd/LastDistro/build-x11/tmp/work/cortexa7hf-neon-poky-linux-gnueabi/ffmpeg/4.1.1-r0/recipe-sysroot-native= -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a7 --sysroot=/home/toanrd/LastDistro/build-x11/tmp/work/cortexa7hf-neon-poky-linux-gnueabi/ffmpeg/4.1.1-r0/recipe-sysroot' --extra-ldflags='-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed' --sysroot=/home/toanrd/LastDistro/build-x11/tmp/work/cortexa7hf-neon-poky-linux-gnueabi/ffmpeg/4.1.1-r0/recipe-sysroot --enable-hardcoded-tables --libdir=/usr/lib --shlibdir=/usr/lib --datadir=/usr/share/ffmpeg --disable-mipsdsp --disable-mipsdspr2 --cpu=cortex-a7 --pkg-config=pkg-config --enable-avcodec --enable-avdevice --enable-avfilter --enable-avformat --enable-avresample --enable-bzlib --enable-gpl --disable-libgsm --disable-indev=jack --disable-libvorbis --enable-lzma --disable-libmp3lame --disable-openssl --enable-postproc --disable-sdl2 --disable-libspeex --enable-swresample --enable-swscale --enable-libtheora --disable-vaapi --disable-vdpau --disable-libvpx --enable-libx264 --enable-outdev=xv
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...
Use -h to get full help or, even better, run 'man ffmpeg'
- I also check with:
$ gst-inspect-1.0 | grep x264
x264: x264enc: x264enc
typefindfunctions: video/x-h264: h264, x264, 264
To install OpenCV-C++ on iMX6UL-EVK, I do cross-compile: streaming, write image are okay, it's make sure OpenCV-C++ cross-compile is okay.
This is my code:
#include <opencv2/opencv.hpp>
#include <opencv2/core.hpp>
#include <opencv2/videoio.hpp>
#include <opencv2/highgui.hpp>
#include <iostream>
#include <stdio.h>
using namespace cv;
using namespace std;
int main()
{
cout << "Built with OpenCV " << CV_VERSION << endl;
Mat image;
Mat src;
Mat frame;
VideoCapture capture;
capture.open(1);
VideoWriter writer;
int codec = VideoWriter::fourcc('m', 'p', '4', 'v');
double fps = 15.0;
string filename = "live.mp4";
writer.open(filename, codec, codec, Size(640,480), true);
cout << "Started writing video... " << endl;
for(int i=0;i<60;i++)
{
capture >> image;
resize(image, frame, Size(640,480));
writer.write(frame);
}
return 0;
}
So did I missing something or wrong way some where ?
Thank you so much,
Toan