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

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

Closed
2 of 13 tasks
RobotnickIsrael opened this issue Nov 8, 2023 · 4 comments
Labels
question Further information is requested rtsp

Comments

@RobotnickIsrael
Copy link

RobotnickIsrael commented Nov 8, 2023

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

@aler9
Copy link
Member

aler9 commented Nov 8, 2023

Please post server logs with logLevel: debug as clearly stated in the instructions.

@aler9 aler9 added question Further information is requested rtsp labels Nov 8, 2023
@RobotnickIsrael
Copy link
Author

Hi.

Just added the accurate logs, as long as whats ffmpeg is giving.

Worth mentioning I tried many AV1 (some encoded with SVT other AOM) files in many different containers (AVI\MP4\WEBM),
with somewhat different parameters (though more oriented to LIVE feeds, thas why I use -re in the command)
Some files I downloaded from 'https://test-videos.co.uk/sintel/mp4-av1' instead of encode with my ffmpeg.
All had the same result.

I'm tried using both the last ffmpeg windows and ffmpeg linux versions to stream the files to mediaMTX.
(Maybe worth saying, that wen I tried streaming to rtp in stead of RTSP, ffmpeg alerted that it doesnt support AV1.
But I'm guessing it's only the rtp output that doesnt support it, iy has no problem to encode, send to rtsp or play av1)

Thank you very much for taking the time to check it out.

@aler9
Copy link
Member

aler9 commented Nov 9, 2023

The issue here is that FFmpeg doesn't support publishing AV1 tracks with RTSP yet. Take a look here:

https://github.com/FFmpeg/FFmpeg/blob/96d2a40b9ee0ddd1844b82c23a074804c316caa5/libavformat/sdp.c#L512

You can see support for VP8, VP9, H265, but there's no AV1 yet.

On the other hand, latest GStreamer is able to publish AV1.

Open an issue in the FFmpeg bug tracker or just implement the feature by yourself and send a patch to the FFmpeg mailing list.

@aler9 aler9 closed this as not planned Won't fix, can't repro, duplicate, stale Nov 9, 2023
Copy link
Contributor

This issue is being locked automatically because it has been closed for more than 6 months.
Please open a new issue in case you encounter a similar problem.

@github-actions github-actions bot locked and limited conversation to collaborators May 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question Further information is requested rtsp
Projects
None yet
Development

No branches or pull requests

2 participants