[FFmpeg-devel] Decklink Output Problem
Deron
deron at pagestream.org
Tue Jan 29 17:33:23 EET 2019
Hello,
A little history: Many years back I started using a modified version of
an unaccepted Decklink output patch, updated it to work for me, and
reposted a newer patch. Of course, the patch was not accepted for many
valid reasons like formatting and working only on Linux but it continued
to work well for me so I have stuck with it. Once an accepted Decklink
"encoder" was introduced, I gave it a try but could never get it to work
right under Ubuntu. Always crashed or did something crazy. I figured it
was me. Well, I've tried it out again and it work now for me. Almost.
This time, instead of just shrugging my shoulders I'm asking if maybe it
is not me since I can get it to work after a minor patch.
The Problem: When I output any video, the last 60 frames are lost. 90%
of the time I would not even notice it, but the other 10% is another
story. No error is produced, and it is not file or command specific.
What appears to me to be happening is that the buffered frames are
tossed out at the end.
The variable "frames_buffer_available_spots" is set to the array size
"frames_buffer" in the function "decklink_setup_video". Minimally,
"frames_buffer" is set to 60. Then the function
"decklink_write_video_packet" will wait if the number of available frame
buffers is zero. All fine and good until it gets to the closing function
"ff_decklink_write_trailer" where an abrupt call to the Decklink
function "StopScheduledPlayback" will do just that and toss out all
buffered frames. I have fixed this issue for me by including the
following ugly busy loop in "ff_decklink_write_trailer".
do {
ctx->dlo->GetBufferedVideoFrameCount(&buffered);
av_log(avctx, AV_LOG_DEBUG, "ff_decklink_write_trailer
frames buffered: %d\n", buffered);
} while (buffered > 1);
A conditional wait would obviously be the proper solution, but my point
was to test my observations.
Another less serious problem I have observed is that if less than 60
frames are buffered to begin with, playback is not even begun. This
would require in the function "ff_decklink_write_trailer" that if
"playback_started" is not true, but frames are buffered, than playback
is started anyway.
Deron
More information about the ffmpeg-devel
mailing list