pedroSG94 / RootEncoder

RootEncoder for Android (rtmp-rtsp-stream-client-java) is a stream encoder to push video/audio to media servers using protocols RTMP, RTSP, SRT and UDP with all code written in Java/Kotlin
Apache License 2.0
2.54k stars 771 forks source link

using RTSP to stream h.265 to "wowza streaming engine" server #350

Closed wsw2435 closed 5 years ago

wsw2435 commented 5 years ago

Hi everyone, would you mind helping on this issue?

I am using the Wowza streaming engine on my pc as the server, and this android app to broadcast a video. How do I make it to stream H.265 video by "Default RTSP" button function to my server? Thank you.

pedroSG94 commented 5 years ago

If you want use H265 RTSP you only need use this method before prepareVideo: https://github.com/pedroSG94/rtmp-rtsp-stream-client-java/blob/master/rtplibrary/src/main/java/com/pedro/rtplibrary/rtsp/RtspCamera1.java#L117

wsw2435 commented 5 years ago

If you want use H265 RTSP you only need use this method before prepareVideo: https://github.com/pedroSG94/rtmp-rtsp-stream-client-java/blob/master/rtplibrary/src/main/java/com/pedro/rtplibrary/rtsp/RtspCamera1.java#L117

Dear Pedro, where should I place rtspCamera1.setVideoCodec(VideoCodec.H265); in ExampleRtspActivitt.java ? I keep crashing the app after I tried a few positions.

pedroSG94 commented 5 years ago

In this line: https://github.com/pedroSG94/rtmp-rtsp-stream-client-java/blob/master/app/src/main/java/com/pedro/rtpstreamer/defaultexample/ExampleRtspActivity.java#L56

Share crash logcat if you can to see error reason

redknight-test commented 1 year ago

can you provide the exact location and the line of the script where it should be changed to get H265 video

pedroSG94 commented 1 year ago

This is the method: https://github.com/pedroSG94/RootEncoder/blob/master/library/src/main/java/com/pedro/library/rtsp/RtspCamera1.java#L137 This is the line to use it: https://github.com/pedroSG94/RootEncoder/blob/master/app/src/main/java/com/pedro/streamer/defaultexample/ExampleRtspActivity.java#L75 The result should be like this:

    ...
    rtspCamera1 = new RtspCamera1(surfaceView, this);
    rtspCamera1.setVideoCodec(VideoCodec.H265);
    rtspCamera1.setReTries(10);
    surfaceView.getHolder().addCallback(this);
}

Remember that you need to import rtsp VideoCodec:

import com.pedro.rtsp.rtsp.VideoCodec;

You can apply the same logic for rtmp, srt and rtsp in all examples (call the method after create the instance and before call preparevideo method)

redknight-test commented 1 year ago

The resolution is coming up as widthheight, it should come up as 19201080 but its coming up as below duration and bitrate is coming up as N/A,
Duration: N/A, start: 0.000000, bitrate: N/A Stream #0:0: Video: hevc (Main), yuv420p(tv, unknown/bt470bg/unknown), 1080x1920, 90k tbr, 90k tbn, 90k tbc Stream #0:1: Audio: aac (LC), 44100 Hz, stereo, fltp 11.87 A-V: 0.002 fd= 2 aq= 47KB vq= 794KB sq= 0B f=1/1

pedroSG94 commented 1 year ago

Hello,

The resolution 1080x1920 is because you are streaming in portrait so the library rotate resolution. You can try rotate it using rotation value of prepareVideo method About duration and bitrate. I'm not sure about it because this also depend of the server used.

redknight-test commented 1 year ago

Streaming is working fine, but how i can confirm the bitrate?

pedroSG94 commented 1 year ago

In the stream side you can check it in the onNewBitrate callback: https://github.com/pedroSG94/RootEncoder/blob/master/app/src/main/java/com/pedro/streamer/defaultexample/ExampleRtspActivity.java#L102 In server/player side this depend of the software used so I can't guide you because each one can use their own way. For example using VLC as player you can check it in tools -> media information -> statistics. This post maybe can help you: https://techviral.net/check-videos-bitrate-in-vlc/

redknight-test commented 1 year ago

But iam unable to play the the stream in VLC or OBS studio, may i know the steps to stream in VLC or Obs-studio

pedroSG94 commented 1 year ago

Try this way for VLC: https://www.thewindowsclub.com/how-to-play-rtsp-stream-in-vlc-media-player If rtsp is not working try with the same url but replace rtsp to rtmp and wowza will change the protocol for you. Also, you maybe need to change the port to 1935 (or rtmp port configured) instead of the rtsp port

redknight-test commented 1 year ago

iam unable to stream in VLC, in the app iam using the endpoint as rtsp://192.168.0.110:2222/app/stream and in the VLC Media Network STream iam using url rtsp://192.168.0.110:2222/app/stream the error is, 00007f60e80010f0] live555 demux error: Failed to connect with rtsp://192.168.0.110:2222 [00007f60e8002f30] main stream error: connection failed: Connection refused

pedroSG94 commented 1 year ago

Are you using the same url than in ffmpeg and the same PC? It should work with the same url If you have wowza server installed in the same PC where you use VLC you can try replace your IP to localhost or 127.0.0.1

redknight-test commented 1 year ago

Iam selecting Custom RTSP in device and the end points are rtsp://192.168.0.110:2222/app/stream In VLC in Network iam using, rtsp://192.168.0.110:2222/app/stream its not working

pedroSG94 commented 1 year ago

I don't know then. Maybe you can try ask on VLC forum or also you can try get bitrate in wowza server side but I don't know how to do it. I think you will need ask on official forums or try to find it yourself