chwe17/FFmpeg-Cedrus can't open my webcam?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

chwe17/FFmpeg-Cedrus can't open my webcam?

cedric.dewijs@telfort.nl
Hi all,
I have a bananapi, running Armbian 5.38. I have done the following steps to compile ffmpeg:
git clone https://github.com/chwe17/FFmpeg-Cedrus.git
cd FFmpeg-Cedrus/
./configure --prefix=/usr --enable-nonfree --enable-gpl --enable-version3 --enable-vdpau --enable-libx264 --enable-libpulse --enable-libv4l2
make -j 2
sudo make install
Now i try to capture and encode video from my webcam:
cedric@bananapi:~$ ffmpeg -i /dev/video0 -c:v cedrus264 -b:v 1000k -vewait 1000 -f h264 test.h264
ffmpeg version git-2018-03-24-e785140 Copyright (c) 2000-2014 the FFmpeg developers
  built on May  4 2018 16:31:39 with gcc 5.4.0 (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.5) 20160609
  configuration: --prefix=/usr --enable-nonfree --enable-gpl --enable-version3 --enable-vdpau --enable-libx264 --enable-libpulse --enable-libv4l2
  libavutil      54.  6.100 / 54.  6.100
  libavcodec     56.  0.101 / 56.  0.101
  libavformat    56.  2.100 / 56.  2.100
  libavdevice    56.  0.100 / 56.  0.100
  libavfilter     5.  0.102 /  5.  0.102
  libswscale      3.  0.100 /  3.  0.100
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  0.100 / 53.  0.100
/dev/video0: Invalid argument
Then I uninstall and reinstall ffmpeg from armbian, so I can test if my webcam itself is to blame. I see this works correctly, but it does not have the options -c:v cedrus264 and -vewait:
cedric@bananapi:~/new/FFmpeg-Cedrus$ ffmpeg -b:v 1000k -f h264 test.h264 -i /dev/video0
ffmpeg version 2.8.14-0ubuntu0.16.04.1 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.9) 20160609
  configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/arm-linux-gnueabihf --incdir=/usr/include/arm-linux-gnueabihf --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
Input #0, video4linux2,v4l2, from '/dev/video0':
  Duration: N/A, start: 1597.248143, bitrate: 110592 kb/s
    Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 640x360, 110592 kb/s, 30 fps, 30 tbr, 1000k tbn, 1000k tbc
File 'test.h264' already exists. Overwrite ? [y/N] y
No pixel format specified, yuv422p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
[libx264 @ 0x1682dc0] using cpu capabilities: ARMv6 NEON
[libx264 @ 0x1682dc0] profile High 4:2:2, level 3.0, 4:2:2 8-bit
Output #0, h264, to 'test.h264':
  Metadata:
    encoder         : Lavf56.40.101
    Stream #0:0: Video: h264 (libx264), yuv422p, 640x360, q=-1--1, 1000 kb/s, 30 fps, 30 tbn, 30 tbc
    Metadata:
      encoder         : Lavc56.60.100 libx264
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
Press [q] to stop, [?] for help
^Cav_interleaved_write_frame(): Immediate exit requested
^CReceived > 3 system signals, hard exiting
After that i repeated the test from above with my compiled version:
cedric@bananapi:~/new/FFmpeg-Cedrus$ ./ffmpeg -v debug  -c:v cedrus264 -b:v 1000k -vewait 1000 -f h264 test.h264 -i /dev/video0
ffmpeg version git-2018-03-24-e785140 Copyright (c) 2000-2014 the FFmpeg developers
  built on May  4 2018 16:31:39 with gcc 5.4.0 (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.5) 20160609
  configuration: --prefix=/usr --enable-nonfree --enable-gpl --enable-version3 --enable-vdpau --enable-libx264 --enable-libpulse --enable-libv4l2
  libavutil      54.  6.100 / 54.  6.100
  libavcodec     56.  0.101 / 56.  0.101
  libavformat    56.  2.100 / 56.  2.100
  libavdevice    56.  0.100 / 56.  0.100
  libavfilter     5.  0.102 /  5.  0.102
  libswscale      3.  0.100 /  3.  0.100
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  0.100 / 53.  0.100
Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set logging level) with argument 'debug'.
Reading option '-c:v' ... matched as option 'c' (codec name) with argument 'cedrus264'.
Reading option '-b:v' ... matched as option 'b' (video bitrate (please use -b:v)) with argument '1000k'.
Reading option '-vewait' ... matched as AVOption 'vewait' with argument '1000'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'h264'.
Reading option 'test.h264' ... matched as output file.
Reading option '-i' ... matched as input file with argument '/dev/video0'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input file /dev/video0.
Successfully parsed a group of options.
Opening an input file: /dev/video0.
[AVIOContext @ 0x214fc80] Statistics: 0 bytes read, 0 seeks
/dev/video0: Invalid argument
Where can I get a version of ffmpeg that uses the h264 hardware encoder for the Allwinner A20 SOC on the bananapi?
Cheers,
Cedric
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: chwe17/FFmpeg-Cedrus can't open my webcam?

Moritz Barsnick
On Mon, May 14, 2018 at 15:48:18 +0200, [hidden email] wrote:
> I have a bananapi, running Armbian 5.38. I have done the following steps to compile ffmpeg:
> git clone https://github.com/chwe17/FFmpeg-Cedrus.git

I would like to claim: If you have issues with that fork of ffmpeg, why
don't you ask there? (Honest question.) That said, that repo isn't even
a proper fork, so it's hard to understand what they changed...but okay.

It's apparently based on a quite old version of ffmpeg, so you'll have
an extremely hard time getting support here. For all we know, any
issues may have been fixed in a long time!

(Cedrus:)
> cedric@bananapi:~$ ffmpeg -i /dev/video0 -c:v cedrus264 -b:v 1000k -vewait 1000 -f h264 test.h264
[...]
(armbian:)
> cedric@bananapi:~/new/FFmpeg-Cedrus$ ffmpeg -b:v 1000k -f h264 test.h264 -i /dev/video0
[...]
(Cedrus:)
> cedric@bananapi:~/new/FFmpeg-Cedrus$ ./ffmpeg -v debug  -c:v cedrus264 -b:v 1000k -vewait 1000 -f h264 test.h264 -i /dev/video0

You order of inputs and outputs in the third command line confuses me.
It might work (does it), but I expect
$ ffmpeg [input options] -i input [output options] output

Have you tried:
$ ffmpeg -i /dev/video0 -f null -
with the Cedrus version (skipping the special encoder)?

This site:
http://linux-sunxi.org/FFmpeg
where the Cedrus patch comes from recommends this:
$ ffmpeg -f v4l2 -video_size 640x480 -i /dev/video0 [...]
Have you tried that?

Furthermore:
(armbian:)

> Then I uninstall and reinstall ffmpeg from armbian, so I can test if my webcam itself is to blame. I see this works correctly, but it does not have the options -c:v cedrus264 and -vewait:
> cedric@bananapi:~/new/FFmpeg-Cedrus$ ffmpeg -b:v 1000k -f h264 test.h264 -i /dev/video0
> ffmpeg version 2.8.14-0ubuntu0.16.04.1 Copyright (c) 2000-2018 the FFmpeg developers

This is extremely old. Can you get hold of a newer binary build for
armbian? ffmpeg-4.0 or recent ffmpeg git, if possible.

> Where can I get a version of ffmpeg that uses the h264 hardware encoder for the Allwinner A20 SOC on the bananapi?

Assuming that Cedrus code used to work - http://linux-sunxi.org/FFmpeg
hints that is was experimental and is unmaintained - you could try to
port their changes to recent ffmpeg. The feasibility of this would be
easier to check if those guys&gals had made it clear which version of
ffmpeg their code is based on[*]. Sigh.

Cheers,
Moritz

[*] This could be some sort of indication:
  libavutil      54.  6.100 / 54.  6.100
  libavcodec     56.  0.101 / 56.  0.101
  libavformat    56.  2.100 / 56.  2.100
  libavdevice    56.  0.100 / 56.  0.100
  libavfilter     5.  0.102 /  5.  0.102
  libswscale      3.  0.100 /  3.  0.100
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  0.100 / 53.  0.100
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: chwe17/FFmpeg-Cedrus can't open my webcam?

Moritz Barsnick
On Mon, May 14, 2018 at 16:27:48 +0200, Moritz Barsnick wrote:
> Assuming that Cedrus code used to work - http://linux-sunxi.org/FFmpeg
> hints that is was experimental and is unmaintained - you could try to
> port their changes to recent ffmpeg. The feasibility of this would be
> easier to check if those guys&gals had made it clear which version of
> ffmpeg their code is based on[*]. Sigh.

This guy figured it out:
https://blog.danman.eu/orangepi-h264-hw-encoding-with-ffmpeg/

You can probably try to cherry-pick his four commits on his cedrus264
branch to ffmpeg git master HEAD and see what that does. :-)

That doesn't necessarily solve your "-i /dev/video0" issue, but it
might make sure you have something proper to work with.

Moritz
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".