Hi,
On an Odroid C2, I used to read IP camera stream with ffmpeg without HW decoding, as it was not available yet.
After reading many threads on this forum, regarding hw decoding through ffmpeg, I decided to give a try....but without any success.
First of all, I tried to decode the Sintel.2010.720p.mkv file, and it worked well.
This is the command I used:
ffmpeg -c:v h264_v4l2m2m -i Sintel.2010.720p.mkv -an -vf fps=1 -f image2 -strftime 1 "/dev/shm/cam1_%S.jpg"
(This takes a snapshot every second from the video file)
And I got this output:
[h264_v4l2m2m @ 0xaaaab68e84f0] driver 'meson-vdec' on card 'Amlogic Video Decoder'
[h264_v4l2m2m @ 0xaaaab68e84f0] Using device /dev/video0
[h264_v4l2m2m @ 0xaaaab68e84f0] driver 'meson-vdec' on card 'Amlogic Video Decoder'
Stream mapping:
Stream #0:0 -> #0:0 (h264 (h264_v4l2m2m) -> mjpeg (native))
Press [q] to stop, [?] for help
[h264_v4l2m2m @ 0xaaaab68e84f0] output POLLERR
[swscaler @ 0xaaaab691f000] deprecated pixel format used, make sure you did set range correctly
Output #0, image2, to '/dev/shm/cam1_%S.jpg':
Metadata:
encoder : Lavf57.83.100
Chapter #0:0: start 0.000000, end 103.125000
Metadata:
title : Chapter 01
Chapter #0:1: start 103.125000, end 148.667000
Metadata:
title : Chapter 02
Chapter #0:2: start 148.667000, end 349.792000
Metadata:
title : Chapter 03
Chapter #0:3: start 349.792000, end 437.208000
Metadata:
title : Chapter 04
Chapter #0:4: start 437.208000, end 472.075000
Metadata:
title : Chapter 05
Chapter #0:5: start 472.075000, end 678.833000
Metadata:
title : Chapter 06
Chapter #0:6: start 678.833000, end 744.083000
Metadata:
title : Chapter 07
Chapter #0:7: start 744.083000, end 888.032000
Metadata:
title : Chapter 08
Stream #0:0(eng): Video: mjpeg, yuvj420p(pc), 1280x544 [SAR 1:1 DAR 40:17], q=2-31, 200 kb/s, 1 fps, 1 tbn, 1 tbc
Metadata:
encoder : Lavc57.107.100 mjpeg
Side data:
cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
frame= 53 fps=3.4 q=4.8 Lsize=N/A time=00:00:53.00 bitrate=N/A speed=3.44x
After that successfull test, I tried this from a CCTV RTSP stream :
ffmpeg -stimeout 5000000 -c:v h264_v4l2m2m -i rtsp://192.168.1.31/11 -an -vf fps=1 -f image2 -strftime 1 "/dev/shm/cam1_%S.jpg"
and I got this output:
[h264 @ 0xaaaadbc04330] corrupted macroblock 16 36 (total_coeff=-1)
[h264 @ 0xaaaadbc04330] error while decoding MB 16 36
[h264 @ 0xaaaadbc04330] concealing 753 DC, 753 AC, 753 MV errors in I frame
Guessed Channel Layout for Input Stream #0.1 : mono
Input #0, rtsp, from 'rtsp://192.168.1.31/11':
Metadata:
title : 10
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0: Video: h264 (Baseline), yuvj420p(pc, bt709, progressive), 1280x720, 2.08 tbr, 90k tbn, 180k tbc
Stream #0:1: Audio: pcm_alaw, 8000 Hz, mono, s16, 64 kb/s
[h264_v4l2m2m @ 0xaaaadbd68c70] driver 'meson-vdec' on card 'Amlogic Video Decoder'
[h264_v4l2m2m @ 0xaaaadbd68c70] Using device /dev/video0
[h264_v4l2m2m @ 0xaaaadbd68c70] driver 'meson-vdec' on card 'Amlogic Video Decoder'
Stream mapping:
Stream #0:0 -> #0:0 (h264 (h264_v4l2m2m) -> mjpeg (native))
Press [q] to stop, [?] for help
[h264_v4l2m2m @ 0xaaaadbd68c70] output POLLERR
[swscaler @ 0xaaaadbc47f60] deprecated pixel format used, make sure you did set range correctly
[Parsed_fps_0 @ 0xaaaadbc668a0] Discarding initial frame(s) with no timestamp.
Output #0, image2, to '/dev/shm/cam1_%S.jpg':
Metadata:
title : 10
encoder : Lavf57.83.100
Stream #0:0: Video: mjpeg, yuvj420p(pc), 1280x720, q=2-31, 200 kb/s, 1 fps, 1 tbn, 1 tbc
Metadata:
encoder : Lavc57.107.100 mjpeg
Side data:
cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
[Parsed_fps_0 @ 0xaaaadbc668a0] Discarding initial frame(s) with no timestamp.
[Parsed_fps_0 @ 0xaaaadbc668a0] Discarding initial frame(s) with no timestamp.
[Parsed_fps_0 @ 0xaaaadbc668a0] Discarding initial frame(s) with no timestamp.
[Parsed_fps_0 @ 0xaaaadbc668a0] Discarding initial frame(s) with no timestamp.
[Parsed_fps_0 @ 0xaaaadbc668a0] Discarding initial frame(s) with no timestamp.
[Parsed_fps_0 @ 0xaaaadbc668a0] Discarding initial frame(s) with no timestamp.
[Parsed_fps_0 @ 0xaaaadbc668a0] Discarding initial frame(s) with no timestamp.
[Parsed_fps_0 @ 0xaaaadbc668a0] Discarding initial frame(s) with no timestamp.
[Parsed_fps_0 @ 0xaaaadbc668a0] Discarding initial frame(s) with no timestamp.
[Parsed_fps_0 @ 0xaaaadbc668a0] Discarding initial frame(s) with no timestamp.
[Parsed_fps_0 @ 0xaaaadbc668a0] Discarding initial frame(s) with no timestamp.
[Parsed_fps_0 @ 0xaaaadbc668a0] Discarding initial frame(s) with no timestamp.
[Parsed_fps_0 @ 0xaaaadbc668a0] Discarding initial frame(s) with no timestamp.
[Parsed_fps_0 @ 0xaaaadbc668a0] Discarding initial frame(s) with no timestamp.
[Parsed_fps_0 @ 0xaaaadbc668a0] Discarding initial frame(s) with no timestamp.
[Parsed_fps_0 @ 0xaaaadbc668a0] Discarding initial frame(s) with no timestamp.
[Parsed_fps_0 @ 0xaaaadbc668a0] Discarding initial frame(s) with no timestamp.
[Parsed_fps_0 @ 0xaaaadbc668a0] Discarding initial frame(s) with no timestamp.
Last message repeated 1 times
frame= 0 fps=0.0 q=0.0 Lsize=N/A time=00:00:00.00 bitrate=N/A speed= 0x
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)
I am using the regular ffmpeg, installed through apt install.
(No compilation from source).
I am using the latest armbian ubuntu stable version:
4.19.20-meson64 #5.75 SMP PREEMPT Fri Feb 8 10:08:40 CET 2019 aarch64 aarch64 aarch64 GNU/Linux
Any sugestions for using HW decoding over a RTSP stream?
Thx
Fabian