Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use H264 instead of VP8 for video #877

Closed
laolsson opened this issue Sep 15, 2016 · 8 comments
Closed

How to use H264 instead of VP8 for video #877

laolsson opened this issue Sep 15, 2016 · 8 comments
Labels
wontfix Issue won't be fixed

Comments

@laolsson
Copy link

Hi,

I followed the quick install guide here:
https://github.com/jitsi/jitsi-meet/blob/master/doc/quick-install.md

and it all works well, using VP8 video codec.

However, I can't figure out how to change the video codec to be H264, how do I do that?

I have tried setting the preferred codec in Firefox but this does not seem to change the sent SDP.

Thanks,
Lars

@thedracle
Copy link

thedracle commented Dec 1, 2016

laolsson,

Jicofo is responsible for sending the codecs that the bridge itself supports.

Since the bridge is the proxy for all of your PeerConnections, it will only negotiate the codecs that the bridge itself advertises.

If you patch src/main/java/org/jitsi/jicofo/util/JingleOfferFactory.java you can add any codecs you like, including VP9.

Here is an example patch I use for H.264:

@@ -192,6 +192,23 @@ private static void addVideoToContent(ContentPacketExtension content,
         absSendTime.setURI(URI.create(RTPExtension.ABS_SEND_TIME_URN));
         rtpDesc.addExtmap(absSendTime);
 
+        // a=rtpmap:107 H264/90000
+        int h264pt = 107;
+        PayloadTypePacketExtension h264
+            = addPayloadTypeExtension(rtpDesc, h264pt, Constants.H264, 90000);
+
+        // a=rtcp-fb:107 ccm fir
+        h264.addRtcpFeedbackType(createRtcpFbPacketExtension("ccm", "fir"));
+
+        // a=rtcp-fb:107 nack
+        h264.addRtcpFeedbackType(createRtcpFbPacketExtension("nack", null));
+
+        // a=rtcp-fb:107 nack pli
+        h264.addRtcpFeedbackType(createRtcpFbPacketExtension("nack", "pli"));
+
+        // a=rtcp-fb:107 goog-remb
+        h264.addRtcpFeedbackType(createRtcpFbPacketExtension("goog-remb", null));
+
         // a=rtpmap:100 VP8/90000
         int vp8pt = 100;
         PayloadTypePacketExtension vp8
@@ -213,12 +230,18 @@ private static void addVideoToContent(ContentPacketExtension content,
         {
             addParameterExtension(
                 vp8, "x-google-min-bitrate", String.valueOf(minBitrate));
+            addParameterExtension(
+                h264, "x-google-min-bitrate", String.valueOf(minBitrate));
+
         }
 
         if (startBitrate != -1)
         {
             addParameterExtension(
                 vp8, "x-google-start-bitrate", String.valueOf(startBitrate));
+
+            addParameterExtension(
+                h264, "x-google-start-bitrate", String.valueOf(startBitrate));
         }
 
         if (useRtx)

@zosnap
Copy link

zosnap commented Dec 22, 2016

I tried this, and it does cause jicofo to advertise h264 in its jingle messages, but in a test conference between a regular chrome window and an incognito chrome window I don't get a video connection. Audio works as normal but the screen just shows "chrome is having connectivity issues...". Do I need to do anything else to chrome or the videobridge to make this work with h264? There aren't any obvious errors in the console, but it does say that the video is muted ("video is now active <video muted=​"true" autoplay "...). Do I need to do something to unmute it? Attaching chrome console log and logs from the docker container running jicofo, jvb, prosody, and nginx in case those help.

conference_chrome.txt
conference_docker.txt

@thedracle
Copy link

thedracle commented Dec 23, 2016

zosnap,

I remember now I ran into this same issue with Chrome- so I went back and dug through my checkins and found this.

Precedes: 

    H264 must be uppercase or Chrome loses its shit.

--------- src/main/java/org/jitsi/jicofo/util/JingleOfferFactory.java ---------
index 471738b..45e2186 100644
@@ -195,7 +195,7 @@ private static void addVideoToContent(ContentPacketExtension content,
         // a=rtpmap:107 H264/90000
         int h264pt = 107;
         PayloadTypePacketExtension h264
-            = addPayloadTypeExtension(rtpDesc, h264pt, Constants.H264, 90000);
+            = addPayloadTypeExtension(rtpDesc, h264pt, Constants.H264.toUpperCase(), 90000);
 
         // a=rtcp-fb:107 ccm fir
         h264.addRtcpFeedbackType(createRtcpFbPacketExtension("ccm", "fir"));

@gpolitis
Copy link
Member

gpolitis commented Nov 6, 2017

@thedracle I just tried on latest Chrome stable (62.0.3202.75) both in p2p mode and in multi-party mode and it works correctly whether it is lower or upper case; however, there may have been an issue with older Chrome versions (and this is a very old issue).

@saghul
Copy link
Member

saghul commented Nov 7, 2017

Have you set the preferH264 setting in the configuration? It defaults to false.

@stale
Copy link

stale bot commented Dec 3, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix Issue won't be fixed label Dec 3, 2018
@stale stale bot closed this as completed Dec 11, 2018
@sliderxtm
Copy link

is any solution without patch jicofo?

@thedracle
Copy link

There is an official way of doing it now, via config:

See:

        preferredCodec: 'VP9',
        disableH264: true,

The same options are on p2p as well. You could prefer H264, set disableH264 to false.

Both of your endpoints will of course have to support H264.

Unfortunately with testing we experienced various intermittent issues using H264, and switched back to VP8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix Issue won't be fixed
Projects
None yet
Development

No branches or pull requests

6 participants