webrtc_streamer - does not save audio and does not display video
DmitryRyumin opened this issue · 3 comments
I have such a problem. There is a code:
from streamlit_webrtc import webrtc_streamer, WebRtcMode
from aiortc.contrib.media import MediaRecorder
def recorder_factory():
return MediaRecorder("test.mp4")
streamer = webrtc_streamer(
key="rec_streamer",
mode=WebRtcMode.SENDONLY,
rtc_configuration={"iceServers": [{"urls": ["stun:stun.l.google.com:19302"]}]},
media_stream_constraints={"video": True, "audio": True},
in_recorder_factory=recorder_factory,
)
At the output, I need to display the video so that it can be seen and write to 1 video file with an audio track. If possible, an example of such work. I would be very grateful.
For displaying the video, just replace WebRtcMode.SENDONLY
with WebRtcMode.SENDRECV
.
I also confirmed that the audio track was successfully recorded with this code in my environment.
For displaying the video, just replace
WebRtcMode.SENDONLY
withWebRtcMode.SENDRECV
.I also confirmed that the audio track was successfully recorded with this code in my environment.
Thanks for the answer! This did start the stream, however now while recording I get an mp4 output file where the audio is recorded and the video is displayed for the first few seconds and then the video freezes and the audio goes on. The output has this message:
[libx264 @ 0x7fc4ef045f00] non-strictly-monotonic PTS
[mp4 @ 0x7fc4f01ddbc0] Application provided invalid, non monotonically increasing dts to muxer in stream 1: -512 >= -512
For displaying the video, just replace
WebRtcMode.SENDONLY
withWebRtcMode.SENDRECV
.
I also confirmed that the audio track was successfully recorded with this code in my environment.Thanks for the answer! This did start the stream, however now while recording I get an mp4 output file where the audio is recorded and the video is displayed for the first few seconds and then the video freezes and the audio goes on. The output has this message:
[libx264 @ 0x7fc4ef045f00] non-strictly-monotonic PTS [mp4 @ 0x7fc4f01ddbc0] Application provided invalid, non monotonically increasing dts to muxer in stream 1: -512 >= -512
@DmitryRyumin did you manage to solve this? I am facing the same issue
it looks like an aiortc thing, but i haven't find a solution for this yet