Opened 4 years ago
#8841 new defect
Can't get SRT stream via ffmpeg on Windows
Reported by: | larse | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | undetermined |
Version: | git-master | Keywords: | srt |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
I have a camera that sends an SRT stream, that I eventually want to process in code via FFMPEGs api. I'd like to do this cross-platform, but getting the stream via ffmpeg seems to fail on my Windows 10 machine.
I can download the stream with the srt-live-transmit tool:
srt-live-transmit srt://:9700?mode=listener file://con > rec.ts
The downloaded file plays in VLC and ffplay. However, on this same machine, I can't download the stream through FFMPEG, it just hangs. This is the command I use:
ffmpeg -i srt://:9700?mode=listener -an -vcodec copy out2.avi
What I've tried, that doesn't work:
- The FFMPEG 4.3 windows build by Zeranoe linked from ffmpeg.org. Result: hangs.
- The latest FFMPEG from git, built by Zeranoe, on a different Windows 10 machine. Result: hangs
- Running Ubuntu 18.04 in Windows Subsystem for Linux, getting FFMPEG 4.3 from apt. Result: hangs.
- Building a minimal FFMPEG (latest from git) on windows, with gnutls, libx264, libx265 and libsrt. Result: hangs
- C++ code that eventually calls avformat_open_input(&format_ctx, "srt://:9700?mode=listener", nullptr, &options). Result: hangs
What works:
- On a machine running plain Ubuntu 18.04 (not under WSL), it works.
- It also works from a mac.
The camera can send either h264 or h265. This does not seem to make a difference, the result is the same.
Here's a full verbose output from ffmpeg -v 9 -loglevel 99:
ffmpeg -i srt://:9700?mode=listener -an -vcodec copy out2.avi -v 9 -loglevel 99 ffmpeg version 4.3 Copyright (c) 2000-2020 the FFmpeg developers built with gcc 9.3.1 (GCC) 20200621 configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libsrt --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libgsm --disable-w32threads --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf libavutil 56. 51.100 / 56. 51.100 libavcodec 58. 91.100 / 58. 91.100 libavformat 58. 45.100 / 58. 45.100 libavdevice 58. 10.100 / 58. 10.100 libavfilter 7. 85.100 / 7. 85.100 libswscale 5. 7.100 / 5. 7.100 libswresample 3. 7.100 / 3. 7.100 libpostproc 55. 7.100 / 55. 7.100 Splitting the commandline. Reading option '-i' ... matched as input url with argument 'srt://:9700?mode=listener'. Reading option '-an' ... matched as option 'an' (disable audio) with argument '1'. Reading option '-vcodec' ... matched as option 'vcodec' (force video codec ('copy' to copy stream)) with argument 'copy'. Reading option 'out2.avi' ... matched as output url. Reading option '-v' ... matched as option 'v' (set logging level) with argument '9'. Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument '99'. Finished splitting the commandline. Parsing a group of options: global . Applying option v (set logging level) with argument 9. Successfully parsed a group of options. Parsing a group of options: input url srt://:9700?mode=listener. Successfully parsed a group of options. Opening an input file: srt://:9700?mode=listener. [NULL @ 00000287b0e2c100] Opening 'srt://:9700?mode=listener' for reading [srt @ 00000287b0e2d280] No default whitelist set
The process does not exit, but doesn't produce any more output either. The file out2.avi never gets created.
I've also tried to play the stream with ffplay, it also hangs.
Piping from srt-live-transmit to ffmpeg works (srt-live-transmit srt://:9700?mode=listener file://con | ffmpeg -i pipe:0 -an -vcodec copy out2.avi)
I also posted this on the srt github issues, they believe it shouldn't be an issue with SRT: https://github.com/Haivision/srt/issues/1451
Is there any known trick to getting SRT streams to work on FFMPEG on Windows? Have anyone gotten this to work on Windows before?