There has been some discussion on the forum how to use FFmpeg to convert the RSTP IP Camera feed to MP4.
Recently, I tried doing the same with my Reolink cameras and I used the same command that has worked fine with my previous IP camera:
ffmpeg -i rtsp://xxx:firstname.lastname@example.org:554/h264Preview_01_main -r 10 -t 60 -vcodec copy -acodec copy -y
But what I found is that the top half of the image is good, but the bottom half is just garbage.
I am not sure if something is missing from my setup, but I don't know how to tell.
And one more info for those visiting this discussion later. Initially I had issues installing ffmpeg on my rapsberry pi. I have raspbian jessie and it is (was) not possible to install ffmpeg using apt-get install as it appears that is missing from this distro. This is why I used avconv instead which appears to be a copy of ffmpeg. But I did manage to install ffmpeg using Post 7 from user Strontium on this discussion: https://www.raspberrypi.org/forums/viewtopic.php?t=170094. I hope my issues above are not the result of this installation method.
Can you include the full ffmpeg command? What version of ffmpeg? Is the green when outputting jpegs or streaming mp4?
If you are playing the mp4 content and the screen is partially green, just accept it because it is an overpriced cam that does the same thing to me most of the time. I hate to publicly bash that brand, but my super cheap generic chinese $20 ip cams perform way better than the $50 reolink that I got from amazn.
If it is a jpeg issue, then you probably need to pass the jpeg buffer through pipe2jpeg to collect all the pieces befores outputting a complete jpeg.
I had to build ffmpeg on my RaspberryPi 3B, it took a while but it works now very well. All this is discussed in this topic, maybe helps. Also seems you have installed and use a very old version of ffmpeg
I think I understand now. Do you constantly re-connect to the cam since the ffmpeg process only runs for 60 seconds and terminated? That particular ip cam craps out if it gets constant new connections. Atleast mine does.
No this was one time only. I was just using this flow to save a 1 minute clip when somebody rings the bell at the gate. I was not using this to continuously record the video. So hopefully not and issue with the constant reconnection.
I also have the misfortune of owning two Reolink RLC-420 5MP cameras and they (among a few other models) have issues with their RTSP stream and mostly only work on the Reolink app. It likely does not help in this situation but I just recently learned the cameras also support RTMP streams and can do that without the issues you described.
On my Android phone and tablet for example I use tinyCam PRO which has handled every other camera I got (5 of different brand and model) but the Reolink cameras I have to view in snapshot mode as the app does not support RTMP and the RTSP stream smears after few seconds of streaming.
It might not be a coincidence then that the only software outside of Reolink's own app where I've got the RTSP stream working has been Shinobi (NVR software) in which Kevin has been involved. It did support RTMP also but for some reason RTSP worked better on the Raspberry docker image I've been testing it with.
This might actually solve the final piece in my quest to setup a light weight Node-RED based NVR solution using object detection (YOLOV4 inference running on a Jetson Nano). Awesome!
@kevinGodell we've been so lucky to have you appear on the forum out of the blue! There's been so many threads with people being more or less clueless with ffmpeg .
So simple setup of the first camera, really easy, thats very clever!
The second camera is so amazingly impressive!!! How can they pack all those features into that little device, unbelievable. I really like the auto-tracking feature, the picture quality, the very fast ptz, object detection, two way audio, wow, I now got appetite to upgrade everything I have, what a solution with YOLO object analyze and detection running in my Jetson Nano that could be!!!
I agree this is very cool. This is probably going to be the next norm, object detection. A custom model training would be great, so my camera would be able to tell if it is the UPS, DPD, or other delivery trucks are at my front door. Or the postman who comes in motorbike
Nice to see the issue is resolved, but in case it's of use to anyone searching, here is my bodged script (worked for years, so never cleaned it up), with stream key removed, of how I both save a feed locally and stream to YouTube live - this is with old Geovision BL2410 cam, but just got a new Annke (Hikvision's cheap brand) 4k camera which will be replacing it - probably through Shinobi with HLS to YT instead.
Worth noting the Geovision provides no audio stream, which was my early problems and this injects a fake aac stream. May be required on some cams.
The exiftool part moved the files into a dated sub-directory every time the stream restarts (or is killed by a daily crontab job) - again primitive, but works.