ffmpeg output with captions

Ask software engineering and SDK questions for developers working on Mac OS X, Windows or Linux.
  • Author
  • Message
Offline

bartman

  • Posts: 2
  • Joined: Wed Jul 24, 2019 3:41 pm
  • Real Name: Bart Trojanowski

ffmpeg output with captions

PostWed Jul 24, 2019 3:53 pm

Hi,

I am using a 'DeckLink Duo 2' card, and would like to pass captions from a UDP stream with ffmpeg out to SDI with captions.

I realize this is an ffmpeg question, but I'm hoping that someone here has experience as documentation of this specific problem is lacking.

I can see in ffmepg's "libavdevice/decklink_enc.cpp" that construct_cc() has the code to encode the captions and pass them to the decklink device.

I'm running "master" of ffmpeg from about 3 months ago (255feeccc5), with blackmagic SDK 11.1. I've built my ffmpeg with:
Code: Select all
--enable-encoders --enable-decoders --enable-vaapi --enable-libzvbi --enable-libklvanc --enable-nvenc --enable-nvdec --enable-vdpau --enable-cuvid --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-decklink


The command I've attempted to use:
Code: Select all
ffmpeg -i 'udp://127.0.0.1:8888/?buffer_size=1048576' -map 0:0 -map 0:1 -map 0:2 -teletext_lines all -c:s copy -f decklink -vframes 10 -pix_fmt uyvy422 'DeckLink Duo (3)'


The output contains:
Code: Select all
  Program 1
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100], 12, 1/90000: Video: hevc (Rext), 1 reference frame (HEVC / 0x43564548), yuv444p(tv), 1280x720 (1280x736) [SAR 1:1 DAR 16:9], 0/1, Closed Captions, 59.94 fps, 59.94 tbr, 90k tbn, 59.94 tbc
    Stream #0:1[0x101], 10, 1/90000: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 384 kb/s
    Stream #0:2[0x102](und), 0, 1/90000: Subtitle: dvb_teletext ([6][0][0][0] / 0x0006)

Code: Select all
Stream mapping:
  Stream #0:0 -> #0:0 (hevc (native) -> wrapped_avframe (native))
  Stream #0:1 -> #0:1 (mp2 (native) -> pcm_s16le (native))
  Stream #0:2 -> #0:2 (copy)


So far things look good, but ffmpeg dies with:
Code: Select all
[decklink @ 0x55bda32d5d00] Unsupported stream type.


This is generated by ff_decklink_write_header() where the "Setup streams" loop does not handle "c->codec_type == AVMEDIA_TYPE_SUBTITLE".

So, I'm at a loss. While the construct_cc() functions suggests that captions are supported, I'm clearly not connecting them through the graph correctly.

Any help would be appreciated.
Offline

bartman

  • Posts: 2
  • Joined: Wed Jul 24, 2019 3:41 pm
  • Real Name: Bart Trojanowski

Re: ffmpeg output with captions

PostWed Jul 24, 2019 8:05 pm

So it turns out I was passing in the wrong pixel format. After removing "-pix_fmt uyvy422" and adding "-vcodec v210" I am seeing captions on SDI.

The full command line is:
Code: Select all
ffmpeg -i 'udp://127.0.0.1:8888/?buffer_size=1048576' -teletext_lines all -vcodec v210 -f decklink 'DeckLink Duo (3)'
Offline

asperi

  • Posts: 16
  • Joined: Sat Nov 27, 2021 5:59 pm
  • Real Name: Matt Cavis

Re: ffmpeg output with captions

PostSat Nov 27, 2021 6:11 pm

Looking for help with a similar issue, playing from a file though. I have built ffmpeg with decklink support, it plays my mpg file fine out the SDI but not seeing any captions on my works broadcast monitor (JVC DT-V17G1Z). This monitor shows captions on SDI from my Mojito card but trying to get it to work with a BlackMagic 4k extreme. The mpg file has embedded 608 and 708 captions. Using the to play-

Code: Select all
ffmpeg -i C:\video\RD2838_720p.mpg -f decklink -teletext_lines all -vcodec v210 "DeckLink 4K Extreme"


MediaInfo on the file-

Code: Select all
Complete name                            : C:\video\RD2838_720p.mpg
Format                                   : MPEG-TS
File size                                : 1.74 GiB
Duration                                 : 28 min 30 s
Overall bit rate mode                    : Constant
Overall bit rate                         : 8 759 kb/s
FileExtension_Invalid                    : ts m2t m2s m4t m4s tmf ts tp trp ty

Video
ID                                       : 4096 (0x1000)
Menu ID                                  : 1 (0x1)
Format                                   : MPEG Video
Format version                           : Version 2
Format profile                           : 4:2:2@High
Format settings                          : CustomMatrix / BVOP
Format settings, BVOP                    : Yes
Format settings, Matrix                  : Custom
Format settings, GOP                     : M=3, N=15
Codec ID                                 : 2
Duration                                 : 28 min 30 s
Bit rate mode                            : Constant
Bit rate                                 : 8 000 kb/s
Width                                    : 1 280 pixels
Height                                   : 720 pixels
Display aspect ratio                     : 16:9
Frame rate                               : 59.940 (60000/1001) FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:2
Bit depth                                : 8 bits
Scan type                                : Progressive
Compression mode                         : Lossy
Bits/(Pixel*Frame)                       : 0.145
Time code of first frame                 : 00:00:00:00
Time code source                         : Group of pictures header
GOP, Open/Closed                         : Closed
Stream size                              : 1.58 GiB (91%)

Audio
ID                                       : 4097 (0x1001)
Menu ID                                  : 1 (0x1)
Format                                   : MPEG Audio
Format version                           : Version 1
Format profile                           : Layer 2
Codec ID                                 : 3
Duration                                 : 28 min 30 s
Bit rate mode                            : Constant
Bit rate                                 : 384 kb/s
Channel(s)                               : 2 channels
Sampling rate                            : 48.0 kHz
Frame rate                               : 41.667 FPS (1152 SPF)
Compression mode                         : Lossy
Stream size                              : 78.3 MiB (4%)
Language                                 : English

Text #1
ID                                       : 4096 (0x1000)-CC1
Menu ID                                  : 1 (0x1)
Format                                   : EIA-608
Muxing mode                              : A/53 / DTVCC Transport
Muxing mode, more info                   : Muxed in Video #1
Duration                                 : 28 min 30 s
Bit rate mode                            : Constant
Stream size                              : 0.00 Byte (0%)
Language                                 : English
CaptionServiceName                       : CC1

Text #2
ID                                       : 4096 (0x1000)-1
Menu ID                                  : 1 (0x1)
Format                                   : EIA-708
Muxing mode                              : A/53 / DTVCC Transport
Muxing mode, more info                   : Muxed in Video #1
Duration                                 : 28 min 30 s
Bit rate mode                            : Constant
Stream size                              : 0.00 Byte (0%)
Language                                 : English



How do I get the Decklink 4k to pass the captions? Thanks!
Offline

asperi

  • Posts: 16
  • Joined: Sat Nov 27, 2021 5:59 pm
  • Real Name: Matt Cavis

Re: ffmpeg output with captions

PostSun Nov 28, 2021 8:55 pm

Hi, anyone know the way to do this with 608/708 rather than DVB/Teletext ?

Code: Select all
ffmpeg -loglevel info -re -i C:\video\RD2838_720p.mpg -c:v wrapped_avframe -pix_fmt uyvy422 -vf scale=1280x720 -c:a pcm_s16le -ar 48000 -ac 2 -f decklink -s 1280x720 -r 60000/1001 -b:v 4M "DeckLink 4K Extreme"


Plays out the SDI but not getting captions.. Thanks!

Return to Software Developers

Who is online

Users browsing this forum: No registered users and 22 guests