sofiactl icon indicating copy to clipboard operation
sofiactl copied to clipboard

Download recording with audio

Open Caian opened this issue 3 years ago • 5 comments

Is it possible to download the audio stream from a recording along with the h264 video? My camera supports it and the iCsee app support it as well.

I tried to modify the existing FileQuery code to look for common audio extensions but none has returned any match,

Caian avatar Nov 04 '21 10:11 Caian

For devices that I've seen the captured stream saved to h264 file if the device has internal memory (i.e. dvr or camera with sd card slot). Camera can do live audio streaming in alaw format, but I don't see the way to get only alaw stream from the already recorded h264 video using sofia protocol. iCsee app could download h264 and extract audio data locally, didn't check how it work. The current app version could get raw audio or h264 video streaming for decoding by external app.

667bdrm avatar Nov 19 '21 22:11 667bdrm

@Caian did you ever figure out how to get audio along with the video?

@667bdrm is the audio typically embedded in the h264 file?

fogleman avatar Mar 14 '23 00:03 fogleman

@fogleman h264 file contains audio stream that playing when using supplied with seller General_DiskPlayer_Beta_V1.0.1.1.T.20210205.exe. I've tried to play it in VLC as described at https://reolink.com/blog/how-to-play-h264-files-in-vlc/ but there are no sound. ffprobe does not able to locate audio stream. Maybe someone could play with multiple demuxers audio codecs.

In the dump the highlighted part looks like alaw sound stream that used in audio commands (and can be played by the following command: play -t al -r 8000 -c 1 ). Probably if extract all these parts from .h264 stream file, concatenate it in the single file, it could be playable. At least using same technique when implemented audio playback (but in the audio commands it already transfered without video stream, only the audio parts). Looks like it needs to be converted to the media container with video/audio tracks supported by vlc, ffmpeg, etc.

sofia-h264-frame

Here is the sample alaw file extracted from the cam firmware huanyingguanglin_english.zip

As I see from beta player file listing it contains libav files and debug files so hopefully decoding parameters could be extracted with debugger:

avcodec-58.dll avdevice-58.dll avfilter-7.dll avformat-58.dll avutil-56.dll Config.ini CrashDumpFile.dmp DiskPlayer.exe DiskPlayer.pdb DllDeinterlace.dll H264Play.dll H264Play.pdb Language lua5.1.dll Password.dll postproc-55.dll Skin StreamReader.dll StreamReader.pdb swresample-3.dll swscale-5.dll Uninstall uninstall.exe WndManager.ocx

Vendor player of my cam (be careful, this is a proprietary software from china vendor and I used it inside virtual machine and did not audited it) DiskPlayer2021-02-05.zip

667bdrm avatar Mar 14 '23 09:03 667bdrm

I now have a working Go program that can convert my camera videos to MP4, including audio:

https://gist.github.com/fogleman/27f5e3beba1d4aba7d2860206607e67c

This is the camera that I am using: https://green-backyard.com/collections/bird-box-camera/products/wireless-bird-box-camera/

fogleman avatar Mar 14 '23 17:03 fogleman

I tried to play downloaded video with mpv, but it cannot detect format. Forcing demuxer helped:

mpv --demuxer-lavf-format=hevc ./idea0_2023-03-17_004_13.30.39-13.30.49\[M\]\[@54f\]\[0\].h264

anktx avatar Mar 17 '23 19:03 anktx