Comments (30)
HomeKit decides which resolution is used to stream the video.
The HomeKit Accessory Protocol supports up- and downgrading the video resolution on the fly. This functionality is currently not implemented. Not sure if that is even possible with ffmpeg!
from hkcam.
I've just pushed 48e4dbc which offers a new command line argument for specifying the minimum video bitrate. This argument in combination with specifying the video size via v4l2-ctl should significantly improve the video quality.
You can set the video size to 720p and the bit rate to 800kbps by updating the run script /etc/sv/hkcam/run/
.
#!/bin/sh -e
exec 2>&1
v4l2-ctl --set-fmt-video=width=1280,height=720,pixelformat=YU12
exec hkcam --min_video_bitrate=800 --data_dir=/var/lib/hkcam/data --verbose=true
Then restart the service via sudo sv restart hkcam
or reboot the device.
Note: Once you specify a minimum bit rate, the streaming to Apple Watch might not work anymore. The Apple Watch wants to have a much lower bit rate.
from hkcam.
Running this on startup increases the image quality for me:
v4l2-ctl --set-fmt-video=width=1280,height=720,pixelformat=YU12
v4l2-ctl -c video_bitrate=1000000
from hkcam.
The wiki tells you more about updating hkcam from source.
from hkcam.
I have ssh into pi zero w and pasted this command.
raspivid -t 0 -b 5000000 -fps 30 -w 1920 -h 1080 -o - | nc -p 1904 -u 192.168.2.108 1234
If you have a hdmi monitor connected the camera video will be shown with excellent quality and very low latency. Rebooted pi by pulling power otherwise pi will freeze with error using sudo reboot.
Opened HomeKit app on iPhone and there is a noticeable improvement. Not as nice as the live view through hdmi but it’s getting there.
from hkcam.
I also have problems with the quality of the video. i've attached a image so you can see what's the trouble.
As you can see it grainy. I've tried several raspivid settings but with no better result? can you help me?
The stills are high quality! like this:
from hkcam.
I have ssh into pi zero w and pasted this command.
raspivid -t 0 -b 5000000 -fps 30 -w 1920 -h 1080 -o - | nc -p 1904 -u 192.168.2.108 1234
If you have a hdmi monitor connected the camera video will be shown with excellent quality and very low latency. Rebooted pi by pulling power otherwise pi will freeze with error using sudo reboot.
Opened HomeKit app on iPhone and there is a noticeable improvement. Not as nice as the live view through hdmi but it’s getting there.
What kind output do you get on that command:
"raspivid -t 0 -b 5000000 -fps 30 -w 1920 -h 1080 -o - | nc -p 1904 -u 192.168.2.108 1234"
and can you explain me what it does?
from hkcam.
I'm seeing this on my Pi Zero too. The Cam works fine, but the quality is not as good as in the screens on the website.
Any ideas why?
from hkcam.
i checked the logfile from hkcam, and there i see that the video resolution ist set to 1024*768 perhaps there is the problem:
2019-05-31_07:56:04.59030 Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 1024x768, 283115 kb/s, 30 fps, 30 tbr, 1000k tbn, 1000k tbc
the cam module should provide 1080p video
from hkcam.
That is good to know, but why is it so blurry on my setup and your screenshots are in good quality.
from hkcam.
Mainly because those screenshots are not taken directly from the camera – they are mockups.
But the snapshots, which are shown in the HomeKit apps, are way higher quality than the video stream.
from hkcam.
thanks for the feedback
from hkcam.
Running this on startup increases the image quality for me:
v4l2-ctl --set-fmt-video=width=1280,height=720,pixelformat=YU12 v4l2-ctl -c video_bitrate=1000000
You are a star bro! The video feed is still a little grainy but it has a lot less latency. Well done it’s much closer to the pi zero default video output viewed in browser.
from hkcam.
I changed the run but I get the following message in log
Verbose logging (default true) 2019-06-21_17:57:14.45689 flag provided but not defined: -min_video_bitrate 2019-06-21_17:57:14.45726 Usage of hkcam: 2019-06-21_17:57:14.45763 -data_dir string 2019-06-21_17:57:14.45770 Path to data directory (default "Camera") 2019-06-21_17:57:14.45794 -h264_decoder string 2019-06-21_17:57:14.45801 h264 video decoder 2019-06-21_17:57:14.45826 -h264_encoder string 2019-06-21_17:57:14.45832 h264 video encoder (default "h264_omx") 2019-06-21_17:57:14.45857 -input_device string 2019-06-21_17:57:14.45863 video input device (default "v4l2") 2019-06-21_17:57:14.45899 -input_filename string 2019-06-21_17:57:14.45906 video input device filename (default "/dev/video0") 2019-06-21_17:57:14.45933 -loopback_filename string 2019-06-21_17:57:14.45940 video loopback device filename (default "/dev/video1") 2019-06-21_17:57:14.45967 -multi_stream 2019-06-21_17:57:14.45973 Allow mutliple clients to view the stream simultaneously (default true) 2019-06-21_17:57:14.45997 -verbose 2019-06-21_17:57:14.46004 Verbose logging (default true)
from hkcam.
@fisch55 You have to compile a new version of hkcam from source as described here
from hkcam.
ok, can I build it directly on PI?
from hkcam.
Yes
from hkcam.
mmmm, for me it does not work...:-(
pi@raspberrypi:~ $ cd hkcam/ pi@raspberrypi:~/hkcam $ make build GOOS=linux GOARCH=arm GOARM=6 go build -o build/hkcam-_linux_armhf/usr/bin/hkcam -i cmd/hkcam/main.go /bin/sh: 1: go: not found Makefile:27: recipe for target 'build' failed make: *** [build] Error 127
I did it like here described:
Update from source
You can also compile the binary yourself. These steps require Git and Go to be installed. On macOS you can install it via Homebrew.
brew install git
brew install go
Clone the project with git clone https://github.com/brutella/hkcam.git
Fetch all branches with git fetch --all
Checkout a specific commit or branch – for example git checkout <commit-hash|branch-name>
Change directory into the project with cd hkcam
Build hkcam with make build
Copy the new binary onto the raspberry pi with scp build/hkcam-_linux_armhf/usr/bin/hkcam [email protected]:~
ssh into the raspberry pi with ssh [email protected] (password raspberry)
Stop the currently running daemon with sudo sv stop hkcam
Override the old binary with the new one sudo mv ~/hkcam /usr/bin/
Restart the hkcam daemon with sudo sv start hkcam
from hkcam.
just apply 48e4dbc and it works perfect
From the current log file these messages show up, not sure if that's okay? #14 still remains an issue... I guess you @brutella made a note of that ;)
Past duration 0.976448 too largeN/A time=00:03:03.93 bitrate=N/A speed= 1x s dup=0 drop=25 speed= 1x =0 drop=25 speed= 1x
Past duration 0.601738 too largeN/A time=00:03:04.46 bitrate=N/A speed= 1x 03.10 bitrate= 805.0kbits/s dup=0 drop=25 speed= 1x
Past duration 0.610634 too largeN/A time=00:03:07.49 bitrate=N/A speed= 1x s dup=0 drop=26 speed= 1x =0 drop=26 speed= 1x
2019-06-24_20:20:00.30241 Past duration 0.918083 too large
Past duration 0.824455 too largeN/A time=00:03:09.53 bitrate=N/A speed= 1x s dup=0 drop=26 speed= 1x =0 drop=26 speed= 1x
2019-06-24_20:20:02.45781 Past duration 0.638008 too large
Past duration 0.718193 too large 5630 fps= 30 q=-0.0 size= 18522kB time=00:03:08.60 bitrate= 804.5kbits/s dup=0 drop=26 speed= 1x
2019-06-24_20:20:02.64061 Past duration 0.970299 too large
Past duration 0.801094 too largeN/A time=00:03:10.53 bitrate=N/A speed= 1x s dup=0 drop=26 speed= 1x
Past duration 0.647545 too large 18680kB time=00:03:10.16 bitrate= 804.7kbits/s dup=0 drop=26 speed= 1x =0 drop=26 speed= 1x
Past duration 0.618889 too largeN/A time=00:03:15.59 bitrate=N/A speed= 1x s dup=0 drop=27 speed= 1x
Past duration 0.617348 too largeN/A time=00:03:16.63 bitrate=N/A speed= 1x s dup=0 drop=27 speed= 1x =0 drop=27 speed= 1x
Past duration 0.627831 too largeN/A time=00:03:17.63 bitrate=N/A speed= 1x s dup=0 drop=27 speed= 1x =0 drop=27 speed= 1x
Past duration 0.627373 too largeN/A time=00:03:18.66 bitrate=N/A speed= 1x s dup=0 drop=27 speed= 1x =0 drop=27 speed= 1x
Past duration 0.611458 too largeN/A time=00:03:19.66 bitrate=N/A speed= 1x s dup=0 drop=27 speed= 1x =0 drop=27 speed= 1x
from hkcam.
Can u explain me how did u do it?
from hkcam.
I run hkcam version 0.0.8. When I change the file run in /etc/sv/hkcam/ the camera does not respond in the Home App. When set to default again the camera works again in the Home App.
from hkcam.
@RobPijpers Do you see an error message in the log file when you try to start a stream from your iOS device with the update run
file?
from hkcam.
@brutella Maybe this is the problem:
2019-07-01_19:39:08.49927 flag provided but not defined: -min_video_bitrate
2019-07-01_19:39:08.50073 Usage of hkcam:
Below the content of my run file:
#!/bin/sh -e
exec 2>&1
v4l2-ctl --set-fmt-video=width=1280,height=720,pixelformat=YU12
exec hkcam --min_video_bitrate=800 --data_dir=/var/lib/hkcam/data --verbose=true
I used the image from this link https://github.com/brutella/hkcam/releases/download/v0.0.8/raspbian-stretch-lite-2019-04-08-hkcam-v0.0.8-armv6.img.zip
from hkcam.
The --min_video_bitrate
option is not available in v0.0.8.
I will include it in v0.0.9.
from hkcam.
@brutella Please post a reply if v0.0.9 is available, thanks!
from hkcam.
v0.0.9 is now available.
from hkcam.
I have run through these steps in this issue, but still have pretty terrible video quality.
I am running on v0.0.9
This is running on anew PI Zero with the official 1080p camera module.
from hkcam.
Your camera seems to be out of focus. Try to change the focus.
from hkcam.
@hindsc52 please post your run file here.
from hkcam.
@hindsc52 please post your run file here.
I have moved this to a new issue as to not clutter up this one, as others have suggested this is a focus issue.
Will post my run in on the nw issue.
from hkcam.
Related Issues (20)
- Rotate feed HOT 1
- [Fixed] Build fails with recent version of Golang: "go build: -i flag is deprecated" HOT 1
- New Version for the RPi Zero 2 ? HOT 5
- How do I access the video stream remote, when I'm not on my local network? HOT 3
- Not working in Bullseye HOT 5
- Does the enclosure fit with the Raspberry Pi Zero WH? HOT 1
- No way to contact Repo Owner? HOT 1
- Setup command doesn't work HOT 7
- /dev/video99 not showing up HOT 1
- Running go task for hkcam fails with "esc": executable file not found in $PATH HOT 5
- /dev/video99: No such file or directory HOT 3
- Logitech C920 - Green video HOT 3
- Still image on Raspberry Pi HOT 1
- "404 Page not found" error on visiting Web Interface HOT 5
- No picture
- Support for two-way audio HOT 2
- Error: Invalid argument HOT 2
- Multiple Cameras
- Not an issue, but Question - PTZ Controls? HOT 1
- Error - Invalid Argument HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hkcam.