Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • gst-plugins-bad gst-plugins-bad
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 986
    • Issues 986
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 132
    • Merge requests 132
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GStreamer
  • gst-plugins-badgst-plugins-bad
  • Issues
  • #1028

Closed
Open
Created Jul 23, 2019 by Adrien Rouhète@Nyquase

No sound when encoding video with H264

Hello,
I stumbled upon a problem when changing codec from VP8 to H264. With H264 no sound is sent, while it works as expected with VP8. Also I only got this bug with Gstreamer 1.15 and above. With Gstreamer 1.14.4, I have sound both with VP8 and H264.

In order to reproduce this, I modified the webrtc demo (the rust one) and changed the video source.
Here is the changes I made:

fn add_h264_video_source(&self) -> Result<(), Error> {
        let videotestsrc = gst::ElementFactory::make("videotestsrc", None).unwrap();
        videotestsrc.set_property_from_str("pattern", "ball");
        videotestsrc.set_property("is-live", &true).unwrap();

        let videoconvert = gst::ElementFactory::make("videoconvert", None).unwrap();
        let videoconvertcaps = gst::Caps::new_simple("video/x-raw", &[("format", &"NV12")]);
        let queue = gst::ElementFactory::make("queue", None).unwrap();

        let x264enc = gst::ElementFactory::make("x264enc", None).unwrap();
        x264enc.set_property_from_str("tune", "zerolatency");
        x264enc.set_property_from_str("speed-preset", "superfast");
        x264enc.set_property_from_str("bitrate", &"3000");
        x264enc.set_property_from_str("key-int-max", &"7");
        x264enc.set_property_from_str("pass", "cbr");
        let x264enc_caps = gst::Caps::new_simple("video/x-h264", &[("profile", &"constrained-baseline")]);


        let queue2 = gst::ElementFactory::make("queue", None).unwrap();
        let h264parse = gst::ElementFactory::make("h264parse", None).unwrap();
        h264parse.set_property_from_str("config-interval", "-1");
        let h264parse_caps = gst::Caps::new_simple("video/x-h264", &[("split-packetized", &true)]);

        let rtph264pay = gst::ElementFactory::make("rtph264pay", None).unwrap();
        let queue3 = gst::ElementFactory::make("queue", None).unwrap();

        self.0
            .pipeline
            .add_many(&[
                &videotestsrc,
                &videoconvert,
                &queue,
                &x264enc,
                &queue2,
                &h264parse,
                &rtph264pay,
                &queue3,
            ])
            .unwrap();

        videotestsrc.link(&videoconvert).unwrap();
        videoconvert.link_filtered(&queue, Some(&videoconvertcaps)).unwrap();
        queue.link(&x264enc).unwrap();
        x264enc.link_filtered(&queue2, Some(&x264enc_caps)).unwrap();
        queue2.link(&h264parse).unwrap();
        h264parse.link_filtered(&rtph264pay, Some(&h264parse_caps)).unwrap();
        rtph264pay.link(&queue3).unwrap();


        let rtp_caps_h264 = gst::Caps::new_simple(
            "application/x-rtp",
            &[
                ("media", &"video"),
                ("encoding-name", &"H264"),
                ("payload", &96i32),
                ("config-interval", &-1),
                ("mtu", &1468),
            ]
        );

        queue3.link_filtered(&self.0.webrtcbin, Some(&rtp_caps_h264))?;

        Ok(())
    }
Assignee
Assign to
Time tracking