How to push H264 stream with ffmpeg

ffmpeg.sh patch
-HTTPIE_COMMAND=“http --check-status”
+HTTPIE_COMMAND=“http --check-status --verify=no”
AUDIO_SSRC=1111
AUDIO_PT=100
VIDEO_SSRC=2222
-VIDEO_PT=101
+VIDEO_PT=125

Verify that a room with id ROOM_ID does exist by sending a simlpe HTTP GET. If

@@ -140,7 +140,7 @@ echo “>>> creating mediasoup video Producer…”
{HTTPIE_COMMAND} -v \ POST {SERVER_URL}/rooms/{ROOM_ID}/broadcasters/{BROADCASTER_ID}/transports/${transportId}/producers
kind=“video” \

  •   rtpParameters:="{ \"codecs\": [{ \"mimeType\":\"video/vp8\", \"payloadType\":${VIDEO_PT}, \"clockRate\":90000 }], \"encodings\": [{ \"ssrc\":${VIDEO_SSRC} }] }" \
    
  •   rtpParameters:="{ \"codecs\": [{ \"mimeType\":\"video/H264\", \"payloadType\":${VIDEO_PT}, \"clockRate\":90000 }], \"encodings\": [{ \"ssrc\":${VIDEO_SSRC} }] }" \
      > /dev/null
    

@@ -164,6 +164,6 @@ ffmpeg
-map 0:a:0
-acodec libopus -ab 128k -ac 2 -ar 48000
-map 0:v:0 \

  •   -pix_fmt yuv420p -c:v libvpx -b:v 1000k -deadline realtime -cpu-used 4 \
    
  •   -pix_fmt yuv420p -c:v libx264  -b:v 1000k -deadline realtime -cpu-used 4 \
      -f tee \
      "[select=a:f=rtp:ssrc=${AUDIO_SSRC}:payload_type=${AUDIO_PT}]rtp://${transportIp}:${transportPort}|[select=v:f=rtp:ssrc=${VIDEO_SSRC}:payload_type=${VIDEO_PT}]rtp://${transportIp}:${transportPort}"
    

but ERROR:
http: warning: HTTP 500 unsupported codec [mimeType:video/H264, payloadType:125]

Sorry, there is no sense in your code above.

  • You are sending video by signaling with both vp8 and h264 in rtpParameters. No way.
  • You are not setting any profile-level-id nor packetization-mode in h264 parameters. This is not how h264 works, sorry.
  • No idea which h264 (and with which parameters) you have enabled in the mediasoup Router.
  • You are then telling ffmpeg to encoder with libopus.

Sorry, too many wrong things. Please read the mediasoup and ffmpeg documentation instead of trying random things.

thank you!

i remove some code in sever’s config.js.
parameters :
{
‘packetization-mode’ : 1,
‘profile-level-id’ : ‘4d0032’,
‘level-asymmetry-allowed’ : 1,
‘x-google-start-bitrate’ : 1000
}
then ffmpeg.sh can’t push ,but lost too much.

it is ok with server config.js:
{
kind : ‘video’,
mimeType : ‘video/h264’,
clockRate : 90000 ,
parameters :
{
‘packetization-mode’ : 1,
‘profile-level-id’ : ‘42c029’,
//‘level-asymmetry-allowed’ : 0,
‘x-google-start-bitrate’ : 2000000
}
}