Body: <p>I am trying to record an input SRT stream with <code>ffmpeg 4.0</code> 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 <code>ffmpeg</code> 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: </p>
  
  <pre><code>$ 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 -&gt; #0:0 (copy)
    Stream #0:1 -&gt; #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.
  </code></pre>
  
  <p>This is my <code>ffprobe</code> output: </p>
  
  <pre><code>$ 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
  </code></pre>
  
  <p>And <code>mediainfo</code> is not even showing me the video stream: </p>
  
  <pre><code>$ 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
  </code></pre>
  
  <p>At the same time if I try to play the input SRT stream with <code>VLC</code> it works just fine and I have picture and audio.<br> 
  [EDIT: 25.02.2019] I have created two log files with the following commands:</p>
  
  <pre><code>$ ffmpeg -i udp://225.0.0.0:3000 -c copy -y -f mpegts -loglevel debug /tmp/test_c_copy.ts &amp;&gt; 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 &amp;&gt; ffmpeg_udp_recording_cv_libx264_ca_copy.txt
  </code></pre>
  
  <p>The log files, as well as the recordings, could be found at <a href="https://goo.gl/2fkNpr" rel="nofollow noreferrer">Google Drive</a> 
  In addition in the <code>ffmpeg_udp_recording_c_copy.txt</code> file I see a lot of errors like: </p>
  
  <pre><code>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 &gt; 10000000: forcing output
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-02-25T12:40:15.713Z
Comments.Text: `video:0kB audio:1623kB ` --> no video has been copied. Is the `-re` flag needed? You're saving to disk. Increase verbosity and check.
Comments.UserDisplayName: Gyan
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-02-25T13:52:28.723Z
Comments.Text: 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.
Comments.UserDisplayName: Georgi Stoyanov
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-02-25T13:59:51.123Z
Comments.Text: @Gyan I will add the log files in around 30 minutes.
Comments.UserDisplayName: Georgi Stoyanov
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-02-25T16:10:01.470Z
Comments.Text: @Gyan added all the debug files and the `ffmpeg` recordings.
Comments.UserDisplayName: Georgi Stoyanov
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-02-26T06:47:10.217Z
Comments.Text: Add `-copyinkf` and check.
Comments.UserDisplayName: Gyan
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-02-26T08:32:21.977Z
Comments.Text: @Gyan, I have executed: `$ ffmpeg -i udp://225.0.0.0:3000 -c copy -y -f mpegts -loglevel debug /tmp/test_c_copy_copyinkf.ts &> ffmpeg_udp_recording_c_copy.txt` and it crashed with: `Conversion failed!` error. I have added the log file to the Google Drive link from the main thread.
Comments.UserDisplayName: Georgi Stoyanov
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-02-26T10:12:44.563Z
Comments.Text: `ffmpeg -i udp://225.0.0.0:3000 -c copy -copyinkf -bsf:v extract_extradata,h264_mp4toannexb -y -f mpegts -loglevel debug /tmp/test_c_copy_copyinkf.ts`
Comments.UserDisplayName: Gyan
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-02-26T12:29:17.347Z
Comments.Text: It is still crashing with the same error. I put the log file in the same directory (ffmpeg_udp_recording_c_copy_bsf.txt)
Comments.UserDisplayName: Georgi Stoyanov
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-02-27T08:22:07.177Z
Comments.Text: How far are the keyframes spaced out?
Comments.UserDisplayName: Gyan
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-02-27T09:10:15.510Z
Comments.Text: it is an open GoP with GoP size of 60, while the frame rate of the video is 25fps, means that rougly every 2.5 seconds there should be an I-frame.
Comments.UserDisplayName: Georgi Stoyanov
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-02-27T10:42:17.230Z
Comments.Text: OK, add only `-max_muxing_queue_size 9999` to your original cmd and check. The bitstream filter won't transform the stream is codec config isn't extracted and available, but codec config looks to be sparse.
Comments.UserDisplayName: Gyan
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-02-27T10:43:44.253Z
Comments.Text: You can also see if you can dump to a raw file: `ffmpeg -re -i srt://10.88.159.70:10000 -c copy -copyinkf -map 0:v -f data srt.264`
Comments.UserDisplayName: Gyan
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-03-01T10:48:00.197Z
Comments.Text: I have changed the input and now everything seems to work fine. So I guess my input source signal wasn't good and this was causing the issues.
Comments.UserDisplayName: Georgi Stoyanov
Tags: <ffmpeg><streaming><vlc><ffprobe>
Title: FFmpeg with input SRT stream very low bitrate
UserDisplayName: Georgi Stoyanov
ThreadText: # FFmpeg with input SRT stream very low bitrate
  
  (Asked by: username_0 on 2019-02-25)
  
  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](https://goo.gl/2fkNpr)
  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
  
  ```
  
  **Tags:** ffmpeg, streaming, vlc, ffprobe
  
  > **Comments:**
  > **username_1**: `video:0kB audio:1623kB ` --> no video has been copied. Is the `-re` flag needed? You're saving to disk. Increase verbosity and check.  
  > **username_0**: 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.  
  > **username_0**: @username_1 I will add the log files in around 30 minutes.  
  > **username_0**: @username_1 added all the debug files and the `ffmpeg` recordings.  
  > **username_1**: Add `-copyinkf` and check.  
  > **username_0**: @username_1, I have executed: `$ ffmpeg -i udp://225.0.0.0:3000 -c copy -y -f mpegts -loglevel debug /tmp/test_c_copy_copyinkf.ts &> ffmpeg_udp_recording_c_copy.txt` and it crashed with: `Conversion failed!` error. I have added the log file to the Google Drive link from the main thread.  
  > **username_1**: `ffmpeg -i udp://225.0.0.0:3000 -c copy -copyinkf -bsf:v extract_extradata,h264_mp4toannexb -y -f mpegts -loglevel debug /tmp/test_c_copy_copyinkf.ts`  
  > **username_0**: It is still crashing with the same error. I put the log file in the same directory (ffmpeg_udp_recording_c_copy_bsf.txt)  
  > **username_1**: How far are the keyframes spaced out?  
  > **username_0**: it is an open GoP with GoP size of 60, while the frame rate of the video is 25fps, means that rougly every 2.5 seconds there should be an I-frame.  
  > **username_1**: OK, add only `-max_muxing_queue_size 9999` to your original cmd and check. The bitstream filter won't transform the stream is codec config isn't extracted and available, but codec config looks to be sparse.  
  > **username_1**: You can also see if you can dump to a raw file: `ffmpeg -re -i srt://10.88.159.70:10000 -c copy -copyinkf -map 0:v -f data srt.264`  
  > **username_0**: I have changed the input and now everything seems to work fine. So I guess my input source signal wasn't good and this was causing the issues.  
  
  ---
  
  ## 0 answers
  
  