prsyahmi / v380

Extract h264 from V380 camera
MIT License
84 stars 32 forks source link

Audio and RTSP streaming #7

Open sbcdave opened 3 years ago

sbcdave commented 3 years ago

Hey prsyahmi. You ever figure out how to get audio out of these v380 cameras?

I remember you mentioning that the types that spit out video for me weren't in the standard. Can you point me to this standard? I can't find anything about a v380 standard.

Also, ffmpeg stopped supporting ffserver and after upgrading my ubuntu to 20.04, now my ffserver/ffmpeg RTSP stream is broken and I have been fighting for a week trying other options and trying to force ffserver to work without any luck. Any advice?

Thanks again for making this.

prsyahmi commented 3 years ago

hi @sbcdave , the audio code is already there, but since there is only 1 stdout the video must be disabled

Uncomment (enable audio code):

Comment Video parts:

I'm still trying to find libraries for muxing/streaming/rtsp. Since I know nothing about codec and streaming standard, it might get a while.

prsyahmi commented 3 years ago

Hi, please take a look here https://github.com/prsyahmi/v380/tree/master/v380-nodejs

sbcdave commented 3 years ago

Nice. I didn't notice that that sox addition was new code 👍

I got my stream working again last night by building ffmpeg-3.2.15 (newer versions don't support rtsp output) and using (github/aler9)'s rtsp-simple-server. Aler9 has a pretty slick setup. Precompiled for a bunch of chips so you can download a single binary and a .yml config file if you don't feel like building it, and the yml lets you set tcp/udp, cofigure multiple streams, stream start on initialization, etc...

I finally made it a systemd service also. Starting the rtsp server in one service and then another service that waits on that and pipes v380 into ffmpeg to the rtsp server.

I also ended up branching your code to use FILE vFile and FILE aFile, and writing to those instead of stdout, while I try to figure out how to get the audio working, so I'll incorporate your sox code and see if I can use a bash script to run v380 and simultaneously start muxing the vFile and aFile file data into ffmpeg.

How did you figure this stuff out? Is there a v380 standard? Is there v380 stream documentation of any kind...somewhere? I'd love to figure out how to send commands to the v380 to turn the light on and off. Another oddity with my setup is that your v380 software has never gotten me anything better than 480x480 video. I wonder if that's because the camera has a low res stream available that you're stealing from 8800 somehow, but that with some other command we can get it to start feeding the higher res stream...?

Thanks again for sharing your work.

prsyahmi commented 3 years ago

@sbcdave I think unix domain socket is more suitable than a file.

AFAIK there is no standard for this. I figured most of these by reversing packets and their apps. https://github.com/prsyahmi/v380/issues/1#issuecomment-547205425

There is a light switch update, resolution update and audio update. Please test new version.

If you are using the nodejs version, audio and video already muxed. If you are writing to file, then this might help: ./ffmpeg -vcodec h264 -probesize 32 -formatprobesize 0 -avioflags direct -flags low_delay -r 20 -i /path/to/v380/VIDEOFILE.264 -f s16le -ar 8000 -acodec adpcm_ima_ws -ac 1 -i /path/to/v380/AUDIOFILE.ADPCM ...followed by output options

sbcdave commented 3 years ago

Awesome. I'll check out the nodejs. Thanks :)

On Wed, Oct 21, 2020, 8:37 PM Syahmi Azhar notifications@github.com wrote:

@sbcdave https://github.com/sbcdave I think unix domain socket is more suitable than a file.

AFAIK there is no standard for this. I figured most of these by reversing packets and their apps. #1 (comment) https://github.com/prsyahmi/v380/issues/1#issuecomment-547205425

There is a light switch update, resolution update and audio update. Please test new version.

If you are using the nodejs version, audio and video already muxed.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/prsyahmi/v380/issues/7#issuecomment-714200337, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADST3WJKKB2ZAUUP4TAWJBLSL6SIPANCNFSM4SZBI3FQ .

sbcdave commented 3 years ago

No luck. I had to patch it to process my type x34 and x35 as video to get it to stop throwing unknown type errors, and for some reason it would launch and seem like it was working, and when I tried to access the stream with VLC open network stream, it would show vlc connecting, but eventually vlc would fail and tell me to look at the logs.

I setup VLC to log to a file and set it to DEBUG (which I think is most verbose) and VLC log only said: -- logger module started -- main: Running vlc with the default interface. Use 'cvlc' to use vlc without interface. main: playlist is empty mjpeg error: cannot peek