mrlt8 / docker-wyze-bridge

WebRTC/RTSP/RTMP/LL-HLS bridge for Wyze cams in a docker container
GNU Affero General Public License v3.0
2.58k stars 158 forks source link

BUG: Recording Playback Issues #1319

Open g-stick opened 1 month ago

g-stick commented 1 month ago

Describe the bug

When attempting to playback on windows, the media player fails to play the audio, there's a pop up saying "we can't play the audio for xxxx-xx-xx_xx-xx-xx. It's encoded in ipcm format which isn't supported. You can still watch the video". The video plays however I am unable to seek forward or backwards.

When I try to use VLC media player, it takes some time to "parse the file" before playback begins. It is able to play the video and audio, and seek works, h ipcm owever it is not very responsive.

Affected Bridge Version

v2.10.1

Bridge type

Docker Run/Compose

Affected Camera(s)

No response

Affected Camera Firmware

No response

docker-compose or config (if applicable)

wyze-bridge:
    <<: *common-keys-core
    container_name: wyze-bridge
    restart: unless-stopped
    image: mrlt8/wyze-bridge:latest
    ports:
      - 1935:1935 # RTMP
      - 8554:8554 # RTSP
      - 8888:8888 # HLS
      - 8889:8889 #WebRTC
      - 8189:8189/udp # WebRTC/ICE
      - 5000:5000 # WEB-UI
    environment:
      <<: *default-tz-puid-pgid
      # [OPTIONAL] (Can be set in the WebUI):
      WYZE_EMAIL: $WYZE_EMAIL
      WYZE_PASSWORD: $WYZE_PASSWORD
      API_ID: $WYZE_KEY_ID
      API_KEY: $WYZE_API_KEY
      WB_IP: 192.168.2.115
      ENABLE_AUDIO: True
      RECORD_ALL: True
      RECORD_LENGTH: 300s
#      RECORD_KEEP: 672h
    volumes:
      - $VAULT/record:/record/
mrlt8 commented 1 month ago

Different cameras versions use different audio codecs. You can force a different audio codec like libopus or aac but keep in mind that different streaming formats may have limited support for some codecs.

VLC will buffer the RTSP stream so that's probably why it takes a while to load, but you can go into the advanced settings to reduce the buffer.

As for seeking, it's probably based on the media player's cache/buffer as livestreams are usually meant to playback at the edge.

g-stick commented 1 month ago

Apologies, I should have been more specific. It isn't the livestream playback that I am having issues with. Rather It is the recorded stream. I have been using the docker version for more than a year now, records onto a HDD and plays back without issues. However with the new version, playback of the recorded stream is now having the listed issues. The older files playback properly as expected.

dhuang083 commented 1 month ago

Apologies, I should have been more specific. It isn't the livestream playback that I am having issues with. Rather It is the recorded stream. I have been using the docker version for more than a year now, records onto a HDD and plays back without issues. However with the new version, playback of the recorded stream is now having the listed issues. The older files playback properly as expected.

Same issue here. I tried 2.10.1 for a day and had to roll back to 2.9.10. There seemed to be something fundamentally different in the codec or formatting or something else, that messed up the timeline when I tried to play on mobile devices and TVs. Perhaps that could be fixed by applying a custom ffmpeg command but I have not figured it out yet...

mrlt8 commented 1 month ago

Unfortunately, this is probably because we switched from recording the streams directly from the camera to having mediaMTX do the recording from the RTSP stream.

Will need to look into this further.

mrlt8 commented 3 weeks ago

Could you try changing the audio codec?

    environment:
        ....
        - AUDIO_CODEC=libopus
mrlt8 commented 3 weeks ago

Has anyone been able to test out if AUDIO_CODEC=libopus helps fix the issue? @g-stick @dhuang083

We could try setting the default audio codec to libopus if that works.

dhuang083 commented 3 weeks ago

Has anyone been able to test out if AUDIO_CODEC=libopus helps fix the issue? @g-stick @dhuang083

We could try setting the default audio codec to libopus if that works.

Sorry, I rolled back to 2.9.12 for stability and playback. I am planning on deploying a secondary NAS and can possibly test there.

g-stick commented 3 weeks ago

Adding the audio codec fixed the error message, however the recorded file is till a little wonky. Playing the file with VLC, it takes a about 10 or more seconds for playback to commence, however one can skip and search the video. With Other media players, searching and skipping is not possible. Also the videos are set to have a length of 300secs. It's almost like the files are not finalized correctly

dhuang083 commented 2 weeks ago

Actually the other thing I liked about 2.9.x version was the automated sectioning when I set it to record 2hrs. The system would start a file every 2hrs according to the clock time instead of actually going by the video length. That made the recording organization much easier. @mrlt8

mrlt8 commented 2 weeks ago

I noticed that as well. Unfortunately, v2.10+ is using mediaMTX to do all the recording, so we have limited control and may have to revert back to the old style of recording to fix some of these issues.