How to get subtitled stream in RTMP from SDI

There was a task to receive a broadcast with subtitles from the SDI signal and send it to the CDN in the RTMP stream format. I will present a couple of weeks of torment and ordeal in a summary of all the series for the collection. Perhaps someone will come in handy.





Let's start with what equipment was used to solve this problem:





To capture a stream from SDI and transcoding, a server with the following configuration was used:





  1. Capture board, two boards tested, Blackmagic DeckLink Duo 2 and DeckLink Quad 2 , both met our expectations.





  2. Video card with hardware support for x264 codec Nvidia Quadro P4000





  3. Server based on Intel (R) Xeon (R) Silver 4114 processor





  4. 64GB memory





To send the stream towards the CDN, we used:





Wowza Streaming Engine server version 8.5 or higher.





It was decided to capture from the map and transfer the stream to Wowza by means of the open source project FFmpeg . This product has proven itself well before and one indisputable advantage among others is that it is free.

But in order for everything to work, we need to build FFmpeg with the necessary list of modules, namely:





  • DeckLink.





    Blackmagic_DeckLink_SDK 10.7, 12. https://blackmagicdesign.com Blackmagic_DeckLink_SDK_12.0.zip

    FFmpeg.









  • Nvidia CUDA .





    wget https://developer.download.nvidia.com/compute/cuda/11.2.0/local_installers/cuda_11.2.0_460.27.04_linux.run
    sudo sh cuda_11.2.0_460.27.04_linux.run
          
          



  • Subtitles SDI ZVBI





    https://sourceforge.net/projects/zapping/files/zvbi/0.2.35/





  • , acc libfdk-aac .





    FFmpeg.

    , , .





FFmpeg .





:





--enable-cuda 
--enable-cuvid 
--enable-nvenc 
--enable-nonfree 
--enable-libnpp 
--extra-cflags=-I/…/cuda/include 
--extra-ldflags=-L/…/cuda/lib64 
--enable-libfdk-aac 
--extra-cflags=-I/…/BlackmagicSDK/Linux/include 
--extra-ldflags=-L/…/BlackmagicSDK/Linux/include 
--enable-decklink 
--enable-libzvbi
      
      



, FFmpeg, FFmpeg .





,

FFmpeg :





ffmpeg







-hwaccel cuvid   ( CUDA)

-f decklink  

-thread_queue_size 16384   8

-teletext_lines all 

-i DeckLink Quad (1)

-c:v h264_nvenc  

-aspect 16:9 -s 1024x576 -filter:v yadif -profile:v main -level 3.1 -preset llhq -gpu any -rc cbrldhq

-g 50 -r 25 -minrate 2000k -b:v 2000k -maxrate 2000k -bufsize 4000k -pixfmt yuv420p

-c:a libfdk-aac -ar 44100 -ac 2 -ab 128k -af volume=10dB -loglevel warning


-metadata:s:s:0 language=rus  , , , - und

-f mpegts udp://...12:6970?pkt_size=1316 mpegts ( FFmpeg), .





As a result, we will get a stream with three substreams (Video, Audio, Subtitles), which is what we wanted!





Now, to capture and send this stream on the WOWZA server side, you need to create a Stream File with the following content in the required application:

by means of the web or by hand in [wowza] / content /





{
uri: “udp://XXX.XXX.XXX.12:6970?pkt_size=1316”,    
mpegtsDVBTeletextType: “1,2,3,4,5”,   ,   ,     2  5   .
mpegtsDVBTeletextPageNumber: “88”,    888 (  )
reconnectWaitTime: “3000”,         
streamTimeout: “5000”        
}
      
      



Next, we connect to this stream and if we did everything correctly, we will see it in the Incoming Streams of your application.





After that, we can go to Stream Targets of your application and send the stream to its destination, in RTMP format in which there will be three substreams (Video, Audio and Data).





On this, kick everything, not much, for objective criticism, Thank you!








All Articles