Skip to content

Error publishing AV1 streams to RTSP server using latest ffmpeg and latest mediaMTX (2023-10-29) "clock rate not found" #2666

Description

@RobotnickIsrael

Which version are you using?

v1.2.1

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

Description
Failure to publish av1 encoded stream to

Describe how to replicate the issue

  1. Create sample files using latest ffmpeg by taking an h264 encoded mp4 file, and transcode it to vp9+h265+av1 using:
    av1: ffmpeg -i h264.mp4 -c:v libsvtav1 -an -crf 35 -svtav1-params fast-decode=1 -g 50 av1.mp4

(h264, h265 and vp9 working)
h265: ffmpeg -i h264.mp4 -c:v libx265 -an -crf 35 -tag:v hvc1 h265.mp4
vp9: ffmpeg -i h264.mp4 -c:v vp9_qsv -crf 35 -g 50 av1.mp4

  1. start the server (linux 1.2.1, or windows 1.2.1, this bug happens in both)

  2. publish with: ffmpeg -stream_loop -1 -re -i av1.mp4 -c:v copy -an -f rtsp rtsp://127.0.0.1:8554/av1

(working lines: )
ffmpeg -stream_loop -1 -re -i vp9.mp4 -c:v copy -an -f rtsp rtsp://127.0.0.1:8554/vp9
ffmpeg -stream_loop -1 -re -i h265.mp4 -c:v copy -an -f rtsp rtsp://127.0.0.1:8554/h265

  1. read with: ffplay -i -f rtsp rtsp://127.0.0.1:8554/av1

(working lines)
ffplay -i -f rtsp rtsp://127.0.0.1:8554/vp9
ffplay -i -f rtsp rtsp://127.0.0.1:8554/h265

  1. H264 WORKS!
    VP9 WORKS!
    H265 WORKS!

  2. AV1 makes error on mediaMTX while publishing (before connecting client):
    Conn... opened
    session created by...
    conn closed: invalid SDP: media 1 is invalid: clock rate not found

ffmpeg breaks done because of it writing:
[out#0/rtsp @ 000001361629b500] Could not write header (incorrect codec parameters ?): Server returned 400 Bad Request.
Error opening output file rtso://127.0.0.1:8554/av1

*I didn't create the SDP, the latest version of ffmpeg did, just as it should have done for the working H264\H265\VP9 files.
**ffplay directly on the file works

Did you attach the server logs?

mediaMTX logs

2023/11/09 11:26:07 INF [RTSP] [conn 20.0.210.160:50052] opened

2023/11/09 11:26:07 DEB [RTSP] [conn 20.0.210.160:50052] [c->s] OPTIONS rtsp://20.0.210.180:8554/av1 RTSP/1.0
CSeq: 1
User-Agent: Lavf60.17.100

2023/11/09 11:26:07 DEB [RTSP] [conn 20.0.210.160:50052] [s->c] RTSP/1.0 200 OK
CSeq: 1
Public: DESCRIBE, ANNOUNCE, SETUP, PLAY, RECORD, PAUSE, GET_PARAMETER, TEARDOWN
Server: gortsplib

2023/11/09 11:26:07 DEB [RTSP] [conn 20.0.210.160:50052] [c->s] ANNOUNCE rtsp://20.0.210.180:8554/av1 RTSP/1.0
CSeq: 2
Content-Length: 157
Content-Type: application/sdp
User-Agent: Lavf60.17.100

v=0
o=- 0 0 IN IP4 127.0.0.1
s=No Name
c=IN IP4 20.0.210.180
t=0 0
a=tool:libavformat 60.17.100
m=video 0 RTP/AVP 96
b=AS:4194
a=control:streamid=0

2023/11/09 11:26:07 INF [RTSP] [session 319bde60] created by 20.0.210.160:50052
2023/11/09 11:26:07 DEB [RTSP] [conn 20.0.210.160:50052] [s->c] RTSP/1.0 400 Bad Request
CSeq: 2
Server: gortsplib

2023/11/09 11:26:07 INF [RTSP] [conn 20.0.210.160:50052] closed: invalid SDP: media 1 is invalid: clock rate not found
2023/11/09 11:26:07 INF [RTSP] [session 319bde60] destroyed: not in use

ffmpeg logs:

ffmpeg -stream_loop -1 -re -i ./videos/av1/Sintel_720_10s_5MB.mp4 -c:v copy -an -f rtsp rtsp://20.0.210.180:8554/av1
ffmpeg version 2023-10-29-git-2532e832d2-full_build-www.gyan.dev Copyright (c) 2000-2023 the FFmpeg developers
built with gcc 12.2.0 (Rev10, Built by MSYS2 project)
configuration: --enable-gpl --enable-version3 --enable-static --pkg-config=pkgconf --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libaribb24 --enable-libaribcaption --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom --enable-libjxl --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libharfbuzz --enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-dxva2 --enable-d3d11va --enable-libvpl --enable-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libcodec2 --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
libavutil 58. 30.100 / 58. 30.100
libavcodec 60. 32.102 / 60. 32.102
libavformat 60. 17.100 / 60. 17.100
libavdevice 60. 4.100 / 60. 4.100
libavfilter 9. 13.100 / 9. 13.100
libswscale 7. 6.100 / 7. 6.100
libswresample 4. 13.100 / 4. 13.100
libpostproc 57. 4.100 / 57. 4.100
[libdav1d @ 000001ec81d511c0] libdav1d 1.3.0-4-gfd4ecc2
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from './videos/av1/Sintel_720_10s_5MB.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomav01iso2mp41
encoder : Lavf58.64.100
Duration: 00:00:10.00, start: 0.000000, bitrate: 4196 kb/s
Chapters:
Chapter #0:0: start 0.000000, end 10.000000
Metadata:
title : Chapter 01
Stream #0:00x1: Video: av1 (Main) (av01 / 0x31307661), yuv420p(pc, progressive), 1280x545, 4194 kb/s, SAR 1:1 DAR 256:109, 30 fps, 30 tbr, 15360 tbn (default)
Metadata:
handler_name : VideoHandler
vendor_id : [0][0][0][0]
Stream #0:10x2: Data: bin_data (text / 0x74786574), 0 kb/s
Metadata:
handler_name : SubtitleHandler
[out#0/rtsp @ 000001ec81d55740] Could not write header (incorrect codec parameters ?): Server returned 400 Bad Request
Error opening output file rtsp://20.0.210.180:8554/av1.
Error opening output files: Server returned 400 Bad Request

Did you attach a network dump?

no

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions