Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Single frame is streamed then times out, not a performance issue #9

Open
mckenziec opened this issue Jan 31, 2018 · 1 comment
Open

Comments

@mckenziec
Copy link

mckenziec commented Jan 31, 2018

Hi.

This is exactly the project I've been meaning to use my Zero W for. I managed to get npm and everything setup for HomeKitCam but I'm finding the stream from iPhone shows the 1st frame when connected, then times out.

The npm/PiCamera_accessory.js script shows the following options when I connect with my iPhone:

bitrate: 299
avconv stream: -f video4linux2 -i /dev/video0 -s 640:480 -threads auto -vcodec h264 -an -pix_fmt yuv420p -f rawvideo -tune zerolatency -vf scale=w=640:h=480 -b:v 100k -bufsize 200k -payload_type 99 -ssrc 1 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params wuxFurc9azRuIgjC98gWfSsmwIDjOdBtRpfu1UtQ srtp://192.168.2.133:64011?rtcpport=64011&localrtcpport=64011&pkt_size=1378

My iPhone shows a frame, then nothing happens until I finally get a "No response" message.

I ran top on another term on the Zero and there's no CPU usage after the 1st frame. When the connection is established, the avconv process will pop at the top with 20% CPU, then disappear from the list while the streaming stalls out.

Is there anyway to figure out the problem that avconv is happen?

@mckenziec
Copy link
Author

Ah ok, sorry. Issue #3 noted how to get /dev/video0 running. Turns out that's what I was missing. I don't know why avconv would not notice the interface was missing but still run without notice. I used the notes below to get steaming working:

sudo rpi-update # to make sure the v4L2 drive is available.
sudo modprobe bcm2835-v4l2 # to load it and create /dev/video0

However now I'm finding that performance may be an issue with the Zero W. avconv is running at 97% CPU. My iPhone indicates that the feed is live. The feed is now dark, and incredibly slow. I thought it was frozen so I moved my Pi but nothing happened, then I noticed some sublet movement so I completely pointed it in another direction. It's been 5 minutes and I still not have a pic of the new direction. So I checked the script console and see this:

bitrate: 299
avconv stream: -f video4linux2 -i /dev/video0 -s 640:480 -threads auto -vcodec h264 -an -pix_fmt yuv420p -f rawvideo -tune zerolatency -vf scale=w=640:h=480 -b:v 100k -bufsize 200k -payload_type 99 -ssrc 1 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params BeF3Z5Dp8J23hCeOhZcKY9UU0ZjgrfmOqrpIkhkL srtp://192.168.2.133:63601?rtcpport=63601&localrtcpport=63601&pkt_size=1378
mmal: mmal_vc_component_enable: failed to enable component: ENOSPC
mmal: camera component couldn't be enabled
mmal: main: Failed to create camera component
mmal: Failed to run camera app. Please check for firmware updates

Anyway to force or switch to taking stills from the camera on an interval when the feed is requested?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant