Embedding plain text into flv video

The goal of this test document is finding out how twitch behaves in reaction to video with embedded plain text data as an additional stream.

Creating the embedded video

# Create the text data
echo "My balls lmao" > data.txt

# Create the combined video
ffmpeg -i video.ts -f data -i data.txt -map 0 -map 1 -f flv test.flv

Extracting the text back

Next you need to check which stream the text was put into by ffmpeg:

$ ffprobe -hide_banner -i test.flv
Input #0, flv, from 'test.flv':
  Metadata:
    encoder         : Lavf60.16.100
  Duration: 00:10:34.62, start: 0.000000, bitrate: 1401 kb/s
  Stream #0:0: Subtitle: text
  Stream #0:1: Audio: mp3, 48000 Hz, stereo, fltp, 128 kb/s
  Stream #0:2: Video: flv1, yuv420p, 1280x720, 200 kb/s, 30 fps, 30 tbr, 1k tbn

In the above example it became Stream #0:0.

Now to extract the data from the flv file:

$ ffmpeg -i test.flv -map 0:0 -c:0 srt -f data output.txt

The -map 0:0 selects the Stream #0:0 stream.

now you should have:

$ cat output.txt
My balls lmao

but does this pass through twitch?

Streaming with the following command, I did not see my channel go live on twitch:

$ ffmpeg -re -stream_loop -1 -i video.ts -f data -i data.txt -map 0 -map 1 -f flv "rtmp://arn04.contribute.live-video.net/app/{stream_key}"

Additional testing

It seems that both subrip and ass subtitle types are unsupported by FLV, and the data codec im using can only have -codec copy, and twitch hates it.