0

I am trying to record an input SRT stream with ffmpeg 4.0 and even though it is recognized as a valid stream and the input stream is around 2.5Mbps, the recording is with only 80-120Kbps. I understand that ffmpeg by default is cutting the null PIDs but even though I would have expected an input bitrate of around 2.2Mbps. This is the command I am using:

$ ffmpeg -re -i srt://10.88.159.70:10000 -c copy -f mpegts /tmp/srt_listener_recording_ffmpeg.ts
Input #0, mpegts, from 'srt://10.88.159.70:10000':
  Duration: N/A, start: 4155.366989, bitrate: N/A
  Program 1
    Stream #0:0[0x1e1]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(top first), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x1e2]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 133 kb/s
Output #0, mpegts, to '/tmp/srt_listener_recording_ffmpeg.ts':
  Metadata:
    encoder         : Lavf58.12.100
    Stream #0:0: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(top first), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 25 fps, 25 tbr, 90k tbn, 90k tbc
    Stream #0:1: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 133 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=    0 fps=0.0 q=-1.0 Lsize=    1808kB time=00:01:44.32 bitrate= 142.0kbits/s speed=0.994x
video:0kB audio:1623kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 11.393347%
Exiting normally, received signal 2.

This is my ffprobe output:

$ ffprobe -i /tmp/srt_listener_recording_ffmpeg.ts
ffprobe version 4.0 Copyright (c) 2007-2018 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.3.0-16ubuntu3)
  configuration: --pkg-config-flags=--static --extra-libs='-lpthread -lm' --toolchain=hardened --enable-gpl --enable-nonfree --enable-version3 --disable-stripping --enable-avisynth --enable-libass --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-librubberband --enable-libshine --enable-libsnappy --enable-libssh --enable-libtwolame --enable-libwavpack --enable-libzvbi --enable-openal --enable-sdl2 --enable-libdrm --enable-frei0r --enable-ladspa --enable-libpulse --enable-libsoxr --enable-libspeex --enable-avfilter --enable-postproc --enable-pthreads --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --disable-ffplay --enable-libopenjpeg --enable-libsrt --enable-libwebp --enable-libxvid --enable-libvidstab --enable-libopenh264 --enable-zlib --enable-openssl
  libavutil      56. 14.100 / 56. 14.100
  libavcodec     58. 18.100 / 58. 18.100
  libavformat    58. 12.100 / 58. 12.100
  libavdevice    58.  3.100 / 58.  3.100
  libavfilter     7. 16.100 /  7. 16.100
  libswscale      5.  1.100 /  5.  1.100
  libswresample   3.  1.100 /  3.  1.100
  libpostproc    55.  1.100 / 55.  1.100
[mpegts @ 0x55b24141afc0] start time for stream 0 is not set in estimate_timings_from_pts
[mpegts @ 0x55b24141afc0] Could not find codec parameters for stream 0 (Video: h264 ([27][0][0][0] / 0x001B), none): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, mpegts, from '/tmp/srt_listener_recording_ffmpeg.ts':
  Duration: 00:01:44.26, start: 1.400000, bitrate: 142 kb/s
  Program 1
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100]: Video: h264 ([27][0][0][0] / 0x001B), none, 90k tbr, 90k tbn, 180k tbc
    Stream #0:1[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 120 kb/s

And mediainfo is not even showing me the video stream:

$ mediainfo /tmp/srt_listener_recording_ffmpeg.ts
General
ID                                       : 1 (0x1)
Complete name                            : /tmp/srt_listener_recording_ffmpeg.ts
Format                                   : MPEG-TS
File size                                : 1.77 MiB
Duration                                 : 1 min 44 s
Overall bit rate mode                    : Variable
Overall bit rate                         : 142 kb/s

Audio
ID                                       : 257 (0x101)
Menu ID                                  : 1 (0x1)
Format                                   : AAC
Format/Info                              : Advanced Audio Codec
Format version                           : Version 4
Format profile                           : LC
Muxing mode                              : ADTS
Codec ID                                 : 15
Duration                                 : 1 min 44 s
Bit rate mode                            : Variable
Channel(s)                               : 2 channels
Channel positions                        : Front: L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy

Menu
ID                                       : 4096 (0x1000)
Menu ID                                  : 1 (0x1)
List                                     : 257 (0x101) (AAC)
Service name                             : Service01
Service provider                         : FFmpeg
Service type                             : digital television

At the same time if I try to play the input SRT stream with VLC it works just fine and I have picture and audio.
[EDIT: 25.02.2019] I have created two log files with the following commands:

$ ffmpeg -i udp://225.0.0.0:3000 -c copy -y -f mpegts -loglevel debug /tmp/test_c_copy.ts &> ffmpeg_udp_recording_c_copy.txt

$ ffmpeg -i udp://225.0.0.0:3000 -c:v libx264 -c:a copy -y -f mpegts -loglevel debug /tmp/test_cv_libx264_ca_copy.ts &> ffmpeg_udp_recording_cv_libx264_ca_copy.txt

The log files, as well as the recordings, could be found at Google Drive In addition in the ffmpeg_udp_recording_c_copy.txt file I see a lot of errors like:

cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[mpegts @ 0x55ed3b9c7000] Delay between the first packet and last packet in the muxing queue is 10016645 > 10000000: forcing output
  • video:0kB audio:1623kB --> no video has been copied. Is the -re flag needed? You're saving to disk. Increase verbosity and check. – Gyan Feb 25 at 12:40
  • the -re flag is not needed, but I have the same output without it. If I remove the -c copy option it works just fine, if I add -c:v copy -c:a copy again the recording is broken. I have tried to update to ffmpeg 4.1 and the result was exactly the same. I have tried to record udp live stream and again with -c copy the recording was broken. – Georgе Stoyanov Feb 25 at 13:52
  • @Gyan I will add the log files in around 30 minutes. – Georgе Stoyanov Feb 25 at 13:59
  • @Gyan added all the debug files and the ffmpeg recordings. – Georgе Stoyanov Feb 25 at 16:10
  • Add -copyinkf and check. – Gyan Feb 26 at 6:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.