Republishing it to Youtube

Azhar Ali

Member
Hi,

I am trying to republish our stream to Youtube. I have done the following but it does not work.
I have enabled full url and restarted the server
Code:
rtmp_transponder_full_url=true
Using client SDK, when we create the stream, we are sending the full Youtube URL
Code:
 session.createStream({
        name: 'mystream',..
        rtmpUrl: rtmp://a.rtmp.youtube.com/live2/0w7p-4zjt-xxxx-xxx
nothing happens on youtube.
I also tried to Get on https://ourwcsserver.com:8444/rest-api/push/find_all but get the following message
Code:
{
    "exception": "com.flashphoner.rest.server.exception.NotFoundException",
    "path": "/rest-api/push/find_all",
    "error": "Not Found",
    "message": "Not found any transponder",
    "timestamp": 1583424420421,
    "status": 404
}
I called the rest-api/stream/find_all and can see an error in there.
Code:
{
        "appKey": "defaultApp",
        "sessionId": "/85.545.555.xx:63848/10.168.0.6:8443-57a1ceb1-757c-4370-b400-b57f4af46bef",
        "mediaSessionId": "4aadc030-5ef9-11ea-bd4a-294846f98a4d",
        "name": "A73531F89E6BCBC2A72A8B08AC33122114E19FFBF89D9DC7D3EF0E85F5DC2287",
        "published": true,
        "hasVideo": true,
        "hasAudio": true,
        "status": "FAILED",
        "sdp": "....",
        "audioCodec": "opus",
        "videoCodec": "H264",
        "info": "Failed by RTMP writer error",
        "record": true,
        "width": 1888,
        "height": 1040,
        "bitrate": 0,
        "minBitrate": 0,
        "maxBitrate": 0,
        "quality": 0,
        "rtmpUrl": "rtmp://a.rtmp.youtube.com/live2/0w7p-xxx-mgt3-4ypq",
        "history": false,
        "gop": 0,
        "fps": 0,
        "audioBitrate": 0,
        "codecImpl": "",
        "transport": "UDP",
        "cvoExtension": false,
        "createDate": 1583423537842,
        "mediaProvider": "WebRTC",
        "origin": "https://oursite.com"
    }
Is there anything else we need to enable?
Can I check any logs to see if there is any error?
 
Last edited:

AzharAli83

New Member
I did some more digging into and got it working. It was working in the webrtc-as-rtmp-republishing.html on our server so I started to compare the code and in the end, it seems to be down to record property on createStream, if i set that to false, video streams to youtube, and true does not.
Would you be able to confirm this?

Also when you stream to youtube, I am sending the constraints as 1280x720 but youtube is complaining the res is 420x380 and it needs to be 1280x720, how can I resolve that?
 

Max

Administrator
Staff member
Good day.
Would you be able to confirm this?
We made some tests on latest build 5.2.548 and can't reproduce the issue. What we've done:
1. Set the folloeing parameters
Code:
rtmp_transponder_full_url=true
rtmp_transponder_stream_name_prefix=
2. Tweak WebRTC as RTMP example as follows
Code:
function startStreaming(session) {
    var streamName = field("streamName");
    var rtmpUrl = field("rtmpUrl");
    session.createStream({
        name: streamName,
        display: localVideo,
        cacheLocalResources: true,
        receiveVideo: false,
        receiveAudio: false,
        rtmpUrl: rtmpUrl,
        record: true
        ...
    }).publish();
}
3. Publish a stream to external server
I also tried to Get on https://ourwcsserver.com:8444/rest-api/push/find_all but get the following message
This REST API query returns only transponders started with REST API /push/startup query which we recommend to use rather than WebSDK in this case. You can check if stream is republished with netstat command
Code:
netstat -np | grep ESTABLISHED
...
tcp 0 8058 your_server:33002 rtmp_server:1935 ESTABLISHED 10107/java
...
Also when you stream to youtube, I am sending the constraints as 1280x720 but youtube is complaining the res is 420x380 and it needs to be 1280x720, how can I resolve that?
WebRTC can drop stream publishing resolution due to actual channel quality and bandwidth. So you have to check channel to server quality, for example using this method.
You can also check actual stream publishing resolution with /stream/metrics REST API query.
 
Top