USB webcam stream to YouTube.com

I need advice on a script to create YouTube.com streaming (RTMP) at least in HD 1920x1080 pixels at 25 fps. Preferably over GStreamer to be able to use GPU hardware.
How can I do that?

vecerapl@vecerapl-nvidia:~$ v4l2-ctl -d /dev/video0 --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
Index : 0
Type : Video Capture
Pixel Format: ‘YUYV’
Name : YUYV 4:2:2
Size: Discrete 3264x2448
Interval: Discrete 0.500s (2.000 fps)
Size: Discrete 2592x1944
Interval: Discrete 0.500s (2.000 fps)
Size: Discrete 2048x1536
Interval: Discrete 0.333s (3.000 fps)
Size: Discrete 1920x1080
Interval: Discrete 0.200s (5.000 fps)
Size: Discrete 1600x1200
Interval: Discrete 0.200s (5.000 fps)
Size: Discrete 1280x960
Interval: Discrete 0.200s (5.000 fps)
Size: Discrete 1280x720
Interval: Discrete 0.100s (10.000 fps)
Size: Discrete 1024x768
Interval: Discrete 0.100s (10.000 fps)
Size: Discrete 800x600
Interval: Discrete 0.040s (25.000 fps)
Size: Discrete 640x480
Interval: Discrete 0.033s (30.000 fps)

    Index       : 1
    Type        : Video Capture
    Pixel Format: 'MJPG' (compressed)
    Name        : Motion-JPEG
            Size: Discrete 3264x2448
                    Interval: Discrete 0.067s (15.000 fps)
            Size: Discrete 2592x1944
                    Interval: Discrete 0.067s (15.000 fps)
            Size: Discrete 2048x1536
                    Interval: Discrete 0.067s (15.000 fps)
            Size: Discrete 1920x1080
                    Interval: Discrete 0.040s (25.000 fps)
            Size: Discrete 1600x1200
                    Interval: Discrete 0.033s (30.000 fps)
            Size: Discrete 1280x960
                    Interval: Discrete 0.033s (30.000 fps)
            Size: Discrete 1280x720
                    Interval: Discrete 0.040s (25.000 fps)
            Size: Discrete 1024x768
                    Interval: Discrete 0.033s (30.000 fps)
            Size: Discrete 800x600
                    Interval: Discrete 0.033s (30.000 fps)
            Size: Discrete 640x480
                    Interval: Discrete 0.033s (30.000 fps)

Hi,
We don’t have experience on this. Would need other user to share suggestion.

A user has shared a method of decoding Youtube videos on Jetson platforms:

Not same as your usecase but FYR.

This works for me, but if I want to use the 16: 9 format, more precisely the
1920x1080 resolution, gstreamer no longer works.
The sound beeps for more and I want to use the sound from the USB camera
there.

Can you advise?

gst-launch-1.0 -v v4l2src device=/dev/video0 ! image/jpeg, width=1600,
height=1200, framerate=30/1, format=MJPG ! jpegdec ! queue ! omxh264enc !
‘video/x-h264, streamformat=(string)byte-stream’ ! h264parse ! flvmux
streamable=true name=mux ! rtmpsink
location=“rtmp://a.rtmp.youtube.com/live2/xxxxx” audiotestsrc ! voaacenc
bitrate=128000 ! mux.

Hi,
Could you go to gstreamer forum to get further suggestion? We don’t actually have experience about streaming to YouTube and may not be able to give good suggestion. Users in gstreamer forum are more experienced and may be able to give guidance. Once you get a working pipeline, you may replace software encoder with hardware encoder to enable hardware acceleration.