Errors and discontinuities while GPU trancoding to H264

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Errors and discontinuities while GPU trancoding to H264

James E. Baird
Hello,

Looking for assistance on this issue I am struggling with. I am trying to take a live OTA stream (free-to-air broadcast) and transcode it (using Nvidia Quadro p2000 card) from mpeg2ts and ac3 to h264 and AAC. I need the output to be in 3 separate bitrates and in UDP multicast format. Here is the source stream from ffprobe output (also gives you my version number for ffmpeg).

==========Source:
gpu-transcoder:~$ ffprobe udp://@239.1.1.92:59092
ffprobe version N-93005-gd92f06e Copyright (c) 2007-2019 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.3.0-27ubuntu1~18.04)
  configuration: --prefix=/home/circle/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/circle/ffmpeg_build/include --extra-ldflags=-L/home/circle/ffmpeg_build/lib --extra-libs='-lpthread -lm' --bindir=/home/circle/bin --enable-gpl --enable-libaom --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree --enable-nvenc
  libavutil      56. 26.100 / 56. 26.100
  libavcodec     58. 44.100 / 58. 44.100
  libavformat    58. 26.100 / 58. 26.100
  libavdevice    58.  6.101 / 58.  6.101
  libavfilter     7. 48.100 /  7. 48.100
  libswscale      5.  4.100 /  5.  4.100
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
[mpeg2video @ 0x5582ad6afa40] Invalid frame dimensions 0x0.
    Last message repeated 19 times
Input #0, mpegts, from 'udp://@239.1.1.92:59092':
  Duration: N/A, start: 73120.077033, bitrate: N/A
  Program 3
    Stream #0:0[0x31]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, bt709, top first), 1920x1080 [SAR 1:1 DAR 16:9], Closed Captions, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Stream #0:1[0x34](eng): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, 5.1(side), fltp, 384 kb/s
    Stream #0:2[0x35](spa): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, stereo, fltp, 96 kb/s (visual impaired)


==========So here is the command that I am using for the transcode:

ffmpeg -i 'udp://@239.1.1.92:59092?fifo_size=1000000&overrun_nonfatal=1' \
-c:v h264_nvenc -x264opts keyint=120:no-scenecut -b:v 6000k -minrate 6000k -maxrate 6000k -bufsize 12000k -profile:v high -level 4.0 -c:a aac -f mpegts udp://@239.129.2.220:59220 \
-c:v h264_nvenc -x264opts keyint=120:no-scenecut -b:v 3500k -minrate 3500k -maxrate 3500k -bufsize 9000k -profile:v high -level 4.0 -c:a aac -f mpegts udp://@239.129.2.221:59221 \
-c:v h264_nvenc -x264opts keyint=120:no-scenecut -b:v 1500k -minrate 1500k -maxrate 1500k -bufsize 3000k -profile:v high -level 4.0 -c:a aac -f mpegts udp://@239.129.2.222:59222


==========Here is the output while the command is running:

gpu-transcoder:~$ ffmpeg -i 'udp://@239.1.1.92:59092?fifo_size=1000000&overrun_nonfatal=1' -c:v h264_nvenc -x264opts keyint=120:no-scenecut -b:v 6000k -minrate 6000k -maxrate 6000k -bufsize 12000k -profile:v high -level 4.0 -c:a aac -f mpegts udp://@239.129.2.220:59220 -c:v h264_nvenc -x264opts keyint=120:no-scenecut -b:v 3500k -minrate 3500k -maxrate 3500k -bufsize 9000k -profile:v high -level 4.0 -c:a aac -f mpegts udp://@239.129.2.221:59221 -c:v h264_nvenc -x264opts keyint=120:no-scenecut -b:v 1500k -minrate 1500k -maxrate 1500k -bufsize 3000k -profile:v high -level 4.0 -c:a aac -f mpegts udp://@239.129.2.222:59222
ffmpeg version N-93005-gd92f06e Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.3.0-27ubuntu1~18.04)
  configuration: --prefix=/home/circle/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/circle/ffmpeg_build/include --extra-ldflags=-L/home/circle/ffmpeg_build/lib --extra-libs='-lpthread -lm' --bindir=/home/circle/bin --enable-gpl --enable-libaom --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree --enable-nvenc
  libavutil      56. 26.100 / 56. 26.100
  libavcodec     58. 44.100 / 58. 44.100
  libavformat    58. 26.100 / 58. 26.100
  libavdevice    58.  6.101 / 58.  6.101
  libavfilter     7. 48.100 /  7. 48.100
  libswscale      5.  4.100 /  5.  4.100
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
[mpeg2video @ 0x564c01e22f40] Invalid frame dimensions 0x0.
    Last message repeated 29 times
Input #0, mpegts, from 'udp://@239.1.1.92:59092?fifo_size=1000000&overrun_nonfatal=1':
  Duration: N/A, start: 73483.943033, bitrate: N/A
  Program 3
    Stream #0:0[0x31]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, bt709, top first), 1920x1080 [SAR 1:1 DAR 16:9], Closed Captions, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Stream #0:1[0x34](eng): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, 5.1(side), fltp, 384 kb/s
    Stream #0:2[0x35](spa): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, stereo, fltp, 96 kb/s (visual impaired)
Codec AVOption x264opts (x264 options) specified for output file #0 (udp://@239.129.2.220:59220) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
Codec AVOption x264opts (x264 options) specified for output file #1 (udp://@239.129.2.221:59221) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
Codec AVOption x264opts (x264 options) specified for output file #2 (udp://@239.129.2.222:59222) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg2video (native) -> h264 (h264_nvenc))
  Stream #0:1 -> #0:1 (ac3 (native) -> aac (native))
  Stream #0:0 -> #1:0 (mpeg2video (native) -> h264 (h264_nvenc))
  Stream #0:1 -> #1:1 (ac3 (native) -> aac (native))
  Stream #0:0 -> #2:0 (mpeg2video (native) -> h264 (h264_nvenc))
  Stream #0:1 -> #2:1 (ac3 (native) -> aac (native))
Press [q] to stop, [?] for help
[aac @ 0x564c01e85080] Using a PCE to encode channel layout "5.1(side)"
[aac @ 0x564c023e04c0] Using a PCE to encode channel layout "5.1(side)"
[aac @ 0x564c01e86980] Using a PCE to encode channel layout "5.1(side)"
Output #0, mpegts, to 'udp://@239.129.2.220:59220':
  Metadata:
    encoder         : Lavf58.26.100
    Stream #0:0: Video: h264 (h264_nvenc) (High), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 6000 kb/s, 29.97 fps, 90k tbn, 29.97 tbc
    Metadata:
      encoder         : Lavc58.44.100 h264_nvenc
    Side data:
      cpb: bitrate max/min/avg: 6000000/0/6000000 buffer size: 12000000 vbv_delay: -1
    Stream #0:1(eng): Audio: aac (LC), 48000 Hz, 5.1(side), fltp, 394 kb/s
    Metadata:
      encoder         : Lavc58.44.100 aac
Output #1, mpegts, to 'udp://@239.129.2.221:59221':
  Metadata:
    encoder         : Lavf58.26.100
    Stream #1:0: Video: h264 (h264_nvenc) (High), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 3500 kb/s, 29.97 fps, 90k tbn, 29.97 tbc
    Metadata:
      encoder         : Lavc58.44.100 h264_nvenc
    Side data:
      cpb: bitrate max/min/avg: 3500000/0/3500000 buffer size: 9000000 vbv_delay: -1
    Stream #1:1(eng): Audio: aac (LC), 48000 Hz, 5.1(side), fltp, 394 kb/s
    Metadata:
      encoder         : Lavc58.44.100 aac
Output #2, mpegts, to 'udp://@239.129.2.222:59222':
  Metadata:
    encoder         : Lavf58.26.100
    Stream #2:0: Video: h264 (h264_nvenc) (High), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 1500 kb/s, 29.97 fps, 90k tbn, 29.97 tbc
    Metadata:
      encoder         : Lavc58.44.100 h264_nvenc
    Side data:
      cpb: bitrate max/min/avg: 1500000/0/1500000 buffer size: 3000000 vbv_delay: -1
    Stream #2:1(eng): Audio: aac (LC), 48000 Hz, 5.1(side), fltp, 394 kb/s
    Metadata:
      encoder         : Lavc58.44.100 aac
frame= 7165 fps= 30 q=19.0 Lq=23.0 q=28.0 size=  201697kB time=00:04:00.34 bitrate=6874.9kbits/s speed=1.02x


=============Here is an ffprobe on one of the streams that I am outputting [minus some of the h264@ lines that repeated several times before probe completed]:

gpu-transcoder:~$ ffprobe udp://@239.129.2.220:59220
ffprobe version N-93005-gd92f06e Copyright (c) 2007-2019 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.3.0-27ubuntu1~18.04)
  configuration: --prefix=/home/circle/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/circle/ffmpeg_build/include --extra-ldflags=-L/home/circle/ffmpeg_build/lib --extra-libs='-lpthread -lm' --bindir=/home/circle/bin --enable-gpl --enable-libaom --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree --enable-nvenc
  libavutil      56. 26.100 / 56. 26.100
  libavcodec     58. 44.100 / 58. 44.100
  libavformat    58. 26.100 / 58. 26.100
  libavdevice    58.  6.101 / 58.  6.101
  libavfilter     7. 48.100 /  7. 48.100
  libswscale      5.  4.100 /  5.  4.100
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
[h264 @ 0x56353920abc0] SPS unavailable in decode_picture_timing
[h264 @ 0x56353920abc0] non-existing PPS 0 referenced
[h264 @ 0x56353920abc0] SPS unavailable in decode_picture_timing
[h264 @ 0x56353920abc0] non-existing PPS 0 referenced
[h264 @ 0x56353920abc0] decode_slice_header error
[h264 @ 0x56353920abc0] no frame!
[mpegts @ 0x5635391b1500] decoding for stream 0 failed
[mpegts @ 0x5635391b1500] decoding for stream 1 failed
[mpegts @ 0x5635391b1500] 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
[mpegts @ 0x5635391b1500] Could not find codec parameters for stream 1 (Audio: aac (LC) ([15][0][0][0] / 0x000F), 0 channels, fltp, 407 kb/s): unspecified sample rate
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, mpegts, from 'udp://@239.129.2.220:59220':
  Duration: N/A, start: 61.453333, bitrate: N/A
  Program 1
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100]: Video: h264 ([27][0][0][0] / 0x001B), none, 29.97 fps, 29.97 tbr, 90k tbn, 180k tbc
    Stream #0:1[0x101](eng): Audio: aac (LC) ([15][0][0][0] / 0x000F), 0 channels, fltp, 407 kb/s



The problem that I am having is our monitoring shows a large amount of errors and discontinuities in the output stream. When I try to play a clip that I save in VLC there is no content, no messages and no length to the video. If I try to play it in vlc from the command line using the ASCII text player (vlc udp://@239.129.2.220:59220 -V aa) I see these warnings "1316 bytes truncated (MTU was 1316)" and no video.

System is an Ubuntu 18.04 install with CUDA 10 installed. It does not look like any of the system resources are bad and I am pulling the clips from the transcoder so I am not having a network issue that is inducing discontinuities which also would not explain the stream errors.


=========Nvidia cad information with nothing running atm:

gpu-transcoder:~$ nvidia-smi
Sat Feb  2 00:51:36 2019
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 410.48                 Driver Version: 410.48                    |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  Quadro P2000        Off  | 00000000:03:00.0 Off |                  N/A |
| 52%   27C    P0    18W /  75W |      0MiB /  5059MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+


Any thoughts on how to correct this. I feel like there is something in my command that is fundamentaly off so I am hoping this is an easy one. Again I am using nvenc for the transcoding. Anything else that you need to assist, just ask.

Thoughts?

Thanks in advance,
Jimbo
CONFIDENTIALITY NOTICE: This e-mail including attachments is covered by the Electronic Communications Privacy Act, 18 U.S.C. ??2510-2521, is confidential and may contain information that is privileged, confidential or otherwise protected from use and disclosure. If you are not the intended recipient, you are hereby notified that any review, disclosure, copying, or dissemination of this transmission, or taking of any action in reliance on its contents, or other use is strictly prohibited. If you have received this transmission in error, please reply to the sender listed above immediately and permanently delete this message from your inbox.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Errors and discontinuities while GPU trancoding to H264

James E. Baird
After spending more time digging through the limited info on the internet, I have made some edits to my command and am seeing better results. I am still seeing a high number of errors and discontinuities however. I believe that I can capture clips now because ffmpeg is buffering the video enough to prevent the discontinuities from showing in the stream. I am still not sure the cause of the errors.

I take it from the lack of response that not many have experience with this. Any ideas would be greatly appreciated.

Here is my new command to transcode.

ffmpeg -i 'udp://@239.1.1.92:59092?fifo_size=1000000&overrun_nonfatal=1' -vcodec h264_nvenc -g 120 -rc cbr -b:v 1500K -profile:v high -level 4.0 -acodec aac -ac 2 -b:a 128k -ar 44100 -f mpegts udp://@239.129.2.242:59242


Thanks,
-James

CONFIDENTIALITY NOTICE: This e-mail including attachments is covered by the Electronic Communications Privacy Act, 18 U.S.C. §§2510-2521, is confidential and may contain information that is privileged, confidential or otherwise protected from use and disclosure. If you are not the intended recipient, you are hereby notified that any review, disclosure, copying, or dissemination of this transmission, or taking of any action in reliance on its contents, or other use is strictly prohibited. If you have received this transmission in error, please reply to the sender listed above immediately and permanently delete this message from your inbox.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Errors and discontinuities while GPU trancoding to H264

James E. Baird
In reply to this post by James E. Baird
Anybody have any thoughts on this?

Thanks,
-James


CONFIDENTIALITY NOTICE: This e-mail including attachments is covered by the Electronic Communications Privacy Act, 18 U.S.C. §§2510-2521, is confidential and may contain information that is privileged, confidential or otherwise protected from use and disclosure. If you are not the intended recipient, you are hereby notified that any review, disclosure, copying, or dissemination of this transmission, or taking of any action in reliance on its contents, or other use is strictly prohibited. If you have received this transmission in error, please reply to the sender listed above immediately and permanently delete this message from your inbox.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Errors and discontinuities while GPU trancoding to H264

Carl Eugen Hoyos-2
In reply to this post by James E. Baird
2019-02-05 15:36 GMT+01:00, James E. Baird <[hidden email]>:

> After spending more time digging through the limited info on the internet, I
> have made some edits to my command and am seeing better results. I am still
> seeing a high number of errors and discontinuities however. I believe that I
> can capture clips now because ffmpeg is buffering the video enough to
> prevent the discontinuities from showing in the stream. I am still not sure
> the cause of the errors.
>
> I take it from the lack of response that not many have experience with this.
> Any ideas would be greatly appreciated.
>
> Here is my new command to transcode.
>
> ffmpeg -i 'udp://@239.1.1.92:59092?fifo_size=1000000&overrun_nonfatal=1'
> -vcodec h264_nvenc -g 120 -rc cbr -b:v 1500K -profile:v high -level 4.0
> -acodec aac -ac 2 -b:a 128k -ar 44100 -f mpegts udp://@239.129.2.242:59242

(Complete, uncut console output missing.)
Is the issue only reproducible with network input?
Is the issue only reproducible with network output?
(In general and from long experience, both
make reproducing the issue impossible.)

> CONFIDENTIALITY NOTICE: This e-mail including attachments
> is covered by the Electronic Communications Privacy Act, 18
> U.S.C. §§2510-2521, is confidential

Please remove this from emails sent to a public mailing list.

Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Errors and discontinuities while GPU trancoding to H264

kumowoon1025
In reply to this post by James E. Baird
> On Feb 1, 2019, at 7:53 PM, James E. Baird <[hidden email]> wrote:
>
> System is an Ubuntu 18.04 install with CUDA 10 installed. It does not look like any of the system resources are bad and I am pulling the clips from the transcoder so I am not having a network issue that is inducing discontinuities which also would not explain the stream errors.

Using udp to transfer mpeg stream with nothing else in the middle, I think you can only hope to minimize discontinuities, you can never be sure if packets on ingress are out-of-order, or dropped. Also, even a few streams could quickly get very chatty packet/s-wise and switches can be fairly aggressive in rate-limiting them.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".