Dotan Simha
Dotan Simha

Reputation: 752

How to overlay images sequence from pipe over a video stream with ffmpeg?

I'm trying to figure out an issue with ffmpeg. I have the following installation: - DeckLink Mini Recorder Card (for HDMI input) - DeckLink Mini Monitor Card (for HDMI output)

I've successfully managed to take the HDMI input from the Decklink card and output is as-is to the output card with the following command:

ffmpeg -f decklink -video_input hdmi -raw_format yuv422p10 -i "DeckLink Mini Recorder" -f decklink -pix_fmt uyvy422 "DeckLink Mini Monitor"

I tried to add a complex-filter to add an overlay of an image, with the following command, and it works:

ffmpeg -f decklink -video_input hdmi -raw_format yuv422p10 -i "DeckLink Mini Recorder" -i ./tools/bin/windows/2.png -y -filter_complex "[0:1][1:0]overlay=10:10" -f decklink -pix_fmt uyvy422 "DeckLink Mini Monitor"

I'm getting a realtime feed from the decklink recorder, the image is added to the stream, and it outputs it to the output HDMI card. Everything seems to work.

Now I tried to change the static image path to use stdin (pipe:0), and I have a tool that constantly streaming PNG images to stdout: ffmpeg -f decklink -video_input hdmi -raw_format yuv422p10 -i "DeckLink Mini Recorder" -i pipe:0 -y -filter_complex "[0:1][1:0]overlay=10:10" -f decklink -pix_fmt uyvy422 "DeckLink Mini Monitor"

The result that i'm getting on the output HDMI card is a static image, of the first frame. The output of ffmpeg also changes now, and it looks like it stuck of the first-second of the stream:

``` frame= 30 fps=7.4 q=-0.0 size=N/A time=00:00:01.00 bitrate=N/A speed=0.247x

{ frames: 30, currentFps: 7, currentKbps: NaN, targetSize: NaN, timemark: '00:00:01.00' } ```

It just remains on 00:00:01.00 and never changes.

I tried to find the issue, and did the following:

The only issue is with: - Tried to stream Decklink Recorder -> pipe:0 (PNG files) overlay -> Decklink Monitor DOES NOT WORK

I suspect that Decklink output is more strict, and my pipe:0 with the PNG images is not stable, and the combination of both causes it to freeze.

Any idea how to solve it? :(

Thanks!

Upvotes: 0

Views: 1043

Answers (1)

Gyan
Gyan

Reputation: 92928

I would first try this

ffmpeg -f decklink -video_input hdmi -raw_format yuv422p10 -i "DeckLink Mini Recorder" \
       -framerate 1/10 -i pipe:0 \
    -y -filter_complex "[1]fps=5[i];[0:1][i]overlay=10:10" \
       -f decklink -pix_fmt uyvy422 "DeckLink Mini Monitor"

where 10 in 1/10 represents the approximate duration in seconds between images sent out over the pipe.

Upvotes: 0

Related Questions