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

rtmp: unsupported video codec: 9 #1550

Closed
1 of 13 tasks
Tabarane opened this issue Mar 10, 2023 · 11 comments · Fixed by #2808
Closed
1 of 13 tasks

rtmp: unsupported video codec: 9 #1550

Tabarane opened this issue Mar 10, 2023 · 11 comments · Fixed by #2808
Labels
bug Something isn't working rtmp

Comments

@Tabarane
Copy link

Which version are you using?

v0.21.5

Which operating system are you using?

  • Linux amd64 standard
  • Linux amd64 Docker
  • Linux arm64 standard
  • Linux arm64 Docker
  • Linux arm7 standard
  • Linux arm7 Docker
  • Linux arm6 standard
  • Linux arm6 Docker
  • Windows amd64 standard
  • Windows amd64 Docker (WSL backend)
  • macOS amd64 standard
  • macOS amd64 Docker
  • Other (please describe)

Describe the issue

Error : (unsupported video codec: 9)

Describe how to replicate the issue

  1. start the server
  2. publish with drone
  3. read with browser webrtc or vlc
  4. error above

Did you attach the server logs?

no

Did you attach a network dump?

no

@Tabarane
Copy link
Author

@aler9 do you need any traffic dumps or configuration for this bug? or what is this error means?

@aler9
Copy link
Member

aler9 commented Mar 14, 2023

Hello, i think the error speaks for itself, you're trying to publish a video track that uses an unsupported codec. Codec 9 is mpeg4-video:
https://github.com/FFmpeg/FFmpeg/blob/870bfe16a12bf09dca3a4ae27ef6f81a2de80c40/libavformat/flv.h#L112

This may be a future enhancement, but at the moment the server doesn't support publishing MPEG4-video tracks.

@aler9 aler9 added enhancement New feature or request rtmp labels Mar 14, 2023
@aler9 aler9 changed the title RTMP ingest : Error : (unsupported video codec: 9) as read error Support publishing MPEG4-video tracks with RTMP Mar 14, 2023
@Tabarane
Copy link
Author

is there a way to use FFMPEG as encoder command? so that we can feed this feed to ffmpeg and give rtsp webrtc?

i tired all ffmpeg commands that i know and it was a failure

in the drone i can only indicate the RTMP path which is given inside the MEDATEX server

example is : RTMP://10.250.200.117:1953/drone1 " this is the stream which is installed in the drone remote"

how i can get the feed and use ffmepg to encode it?

@aler9
Copy link
Member

aler9 commented Mar 14, 2023

If the Drone requires a server, you have to use a RTMP server that supports the MPEG4-video codec. Maybe nginx-rtmp supports it. After you found a server, you can use ffmpeg to pull the stream from the RTMP server, convert it and publish it to MediaMTX. Otherwise, you can try to develop the feature yourself. Personally in this moment i haven't enough documentation about MPEG4-video, its difference with H264, how it's streamed with RTMP, so i don't have a way to quickly fix the issue.

@Tabarane
Copy link
Author

we can not use the ffmpeg inside MeduaMTX directly?

like the below sample you gave?

paths:
  all:
  original:
    runOnReady: ffmpeg -i rtsp://localhost:$RTSP_PORT/$RTSP_PATH -pix_fmt yuv420p -c:v libx264 -preset ultrafast -b:v 600k -max_muxing_queue_size 1024 -f rtsp rtsp://localhost:$RTSP_PORT/compressed
    runOnReadyRestart: yes

aler9 added a commit to bluenviron/gortsplib that referenced this issue Apr 10, 2023
aler9 added a commit to bluenviron/gortsplib that referenced this issue Apr 10, 2023
aler9 added a commit to bluenviron/gortsplib that referenced this issue Apr 10, 2023
@Tabarane
Copy link
Author

Tabarane commented Apr 13, 2023

@aler9 man you are the best :)) i will test it soon and give you feedback as soon as possible :)

just question : does this mean i can send the RTMP and hope to get the streams as needed in RTSP? im abit confused that this codec support went to RTSP while in main page RTMP still showing only audio support

@aler9
Copy link
Member

aler9 commented Apr 13, 2023

@Tabarane wait a second, i just added the track definition to the server, that's just the first step into implementing this.

Since v0.22.1, MPEG4-video tracks published to the server (through RTSP) are not recognized as "generic" but recognized as "MPEG4-video" tracks.

The second step will be implementing decoding MPEG4-video tracks from RTSP to access units (base unit of the codec) and vice versa.

Third step will be implementing encoding MPEG4-video tracks from access units to RTMP.

In this way, it will be possible to publish MPEG4-video tracks from RTMP and read them with RTMP.

BTW, MPEG4-video is an alias for MPEG-4 part 2 video, that is an alias for DivX / Xvid.

@Tabarane
Copy link
Author

understood, so this is only first step in 4 steps process :)) can not wait until it available , there is alot of things dependable on it as there is alot of DJI controller that purely using this only and i have around 35 drone plus

@aler9
Copy link
Member

aler9 commented May 1, 2023

@Tabarane please run this nightly release, make a drone publish to it for 10 seconds and post logs.
This is the only way for understanding the video format, since nor FFmpeg nor GStreamer support publishing MPEG-4 video with RTMP.
[link removed]

@aler9 aler9 changed the title Support publishing MPEG4-video tracks with RTMP rtmp: unsupported video codec: 9 Dec 14, 2023
@aler9 aler9 added bug Something isn't working and removed enhancement New feature or request labels Dec 14, 2023
@aler9
Copy link
Member

aler9 commented Dec 14, 2023

Hello, this should be fixed by #2808. Please test this nightly release and let me know if it works (click on artifacts, binaries):
https://github.com/bluenviron/mediamtx/actions/runs/7207849258

Copy link
Contributor

This issue is mentioned in release v1.4.1 🚀
Check out the entire changelog by clicking here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working rtmp
Projects
None yet
2 participants