Hi guys,
I am trying to configure my h264 cameras with zm(using ffmpeg). For some reason, ffmpeg is not able to identify the stream format and returns "Invalid data found when processing input". However if I pass on "-f h264" (which means force format) as parameter before -i <url>, that is able to force the format and thus ffmpeg is able to decode the stream.
Not working:
ffmpeg -i 'http://admin:@172.20.14.35:80/livestrea ... audio_data' ~/sss.mp4
ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)
...
...
http://admin:@172.20.14.35:80/livestrea ... audio_data: Invalid data found when processing input
Working if "-f h264" is passed:
ffmpeg -f h264 -i 'http://admin:@172.20.14.35:80/livestrea ... audio_data' ~/sss.mp4
ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)
...
...
Input #0, h264, from 'http://admin:@172.20.14.35:80/livestrea ... audio_data':
Duration: N/A, bitrate: N/A
Stream #0:0: Video: h264 (High), yuvj420p(pc, bt709, progressive), 1280x960, 25 fps, 25 tbr, 1200k tbn, 50 tbc
I am seeing the same error in zoneminder logs, and seems the reason is same. I want to know if there is way out that I can pass "-f h264" before -i (camera url) in zoneminder monitor somewhere to get it working? I have tried setting f=h264 in ffmpeg options, but it has not helped.
How to add force format parameter to ffmpeg
-
- Posts: 1373
- Joined: Sat Aug 31, 2019 7:35 am
- Location: San Diego
Re: How to add force format parameter to ffmpeg
I don't recall if it's present in 1.34, but in 1.36 on the Source page of the monitor, there is "Options" for that purpose.
Re: How to add force format parameter to ffmpeg
Thanks for quick reply. The "Options" are there in 1.34, but if I add the f=h264 in options, I see below in logs. Could it be because of a different version of ffmpeg on my system VS the one being used by zoneminder? Not sure if that is possible.dougmccrary wrote: ↑Sun Jul 18, 2021 9:38 am I don't recall if it's present in 1.34, but in 1.36 on the Source page of the monitor, there is "Options" for that purpose.
Code: Select all
zmc_m1[116508].WAR-zm_ffmpeg_camera.cpp/409 [Option f not recognized by ffmpeg]

Code: Select all
Parameters in this field are passed on to FFmpeg. Multiple parameters can be separated by ,
Examples (do not enter quotes)
"allowed_media_types=video" Set datatype to request from cam (audio, video, data)
"reorder_queue_size=nnn" Set number of packets to buffer for handling of reordered packets
if I don't add "-f h264", it errors out while parsing.
Code: Select all
zmc_m5[108853].WAR-zm_ffmpeg_camera.cpp/354 [Could not parse ffmpeg input options '-f h264']
-
- Posts: 494
- Joined: Sun Jun 29, 2014 1:12 pm
- Location: Melbourne, AU
Re: How to add force format parameter to ffmpeg
Ffmpeg libraries are in use not the command line so those switches don’t work. The ones listed in help are part of RTSP protocol, as originally this was part of how we chose the RTSP transport method. I think more opts are now passed to the various calls, so maybe you can try that.
Not sure if this will work as I have not tested it, but worth a try.
video_codec_id=AV_CODEC_ID_H264
I have not looked at the ffmpeg code to work out what -f h264 is doing but this seems like a good guess.
Already on the latest ffmpeg so not much to try there. Maybe the camera has some config options that are causing it, like h264+. Prefer to address root cause if we can.
Not sure if this will work as I have not tested it, but worth a try.
video_codec_id=AV_CODEC_ID_H264
I have not looked at the ffmpeg code to work out what -f h264 is doing but this seems like a good guess.
Already on the latest ffmpeg so not much to try there. Maybe the camera has some config options that are causing it, like h264+. Prefer to address root cause if we can.
Production Zoneminder 1.37.x (Living dangerously)
Random Selection of Cameras (Dahua and Hikvision)
Random Selection of Cameras (Dahua and Hikvision)
Re: How to add force format parameter to ffmpeg
Thanks for your reply. Tried the option, it didn't show any error message but the issue still persistsSteveGilvarry wrote: ↑Mon Jul 19, 2021 12:06 am Ffmpeg libraries are in use not the command line so those switches don’t work. The ones listed in help are part of RTSP protocol, as originally this was part of how we chose the RTSP transport method. I think more opts are now passed to the various calls, so maybe you can try that.
Not sure if this will work as I have not tested it, but worth a try.
video_codec_id=AV_CODEC_ID_H264
I have not looked at the ffmpeg code to work out what -f h264 is doing but this seems like a good guess.
Already on the latest ffmpeg so not much to try there. Maybe the camera has some config options that are causing it, like h264+. Prefer to address root cause if we can.

Code: Select all
07/19/21 00:25:35.416300 zmc_m6[21346].ERR-zm_ffmpeg_camera.cpp/393 [Unable to open input http://admin:@172.20.14.36:80/livestream/11?action=play&media=video_audio_data due to: Invalid data found when processing input]
07/19/21 00:25:35.466302 zmc_m6[21346].ERR-zmc.cpp/257 [Failed to prime capture of initial monitor]
Thanks for checking on it!
-
- Posts: 494
- Joined: Sun Jun 29, 2014 1:12 pm
- Location: Melbourne, AU
Re: How to add force format parameter to ffmpeg
Production Zoneminder 1.37.x (Living dangerously)
Random Selection of Cameras (Dahua and Hikvision)
Random Selection of Cameras (Dahua and Hikvision)
Re: How to add force format parameter to ffmpeg
Nope, no other ports are open on my camerasSteveGilvarry wrote: ↑Mon Jul 19, 2021 6:10 am viewtopic.php?t=18727
Seems very similar url to yours.
Try RTSP://user:pass@ip:554/11

Code: Select all
nmap 172.20.14.36
Starting Nmap 7.80 ( https://nmap.org ) at 2021-07-19 23:17 CDT
Nmap scan report for 172.20.14.36
Host is up (0.019s latency).
Not shown: 998 closed ports
PORT STATE SERVICE
23/tcp open telnet
80/tcp open http
Nmap done: 1 IP address (1 host up) scanned in 0.44 seconds
Code: Select all
ffmpeg -i rtsp://admin:@172.20.14.36:554/11 aab.mp4
ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers
...
...
[tcp @ 0x555df2a6d900] Connection to tcp://172.20.14.36:554?timeout=0 failed: Connection refused
rtsp://admin:@172.20.14.36:554/11: Connection refused