Open nrmmota opened 8 years ago
I tried to add this code, but I'm obviously missing something :D
if (v_frame) {
v_frame->GetBytes((void **)&frame_bytes);
if (v_frame->GetFlags() & bmdFrameHasNoInputSource) {
// log
unsigned bars[8] = {
0xEA80EA80, 0xD292D210, 0xA910A9A5, 0x90229035,
0x6ADD6ACA, 0x51EF515A, 0x286D28EF, 0x10801080 };
int width = v_frame->GetWidth();
int height = v_frame->GetHeight();
unsigned *p = (unsigned *)frame_bytes;
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x += 2)
*p++ = bars[(x * 8) / width];
}
v_frame->GetStreamTime(×tamp, &duration, timebase);
video_cb(ctx, frame_bytes,
width,
height,
v_frame->GetRowBytes(),
timestamp,
duration, 0);
}
I found out why it wasn't working properly for me. I was using bmdFormat10BitYUV instead of bmdFormat8BitYUV. The code above works for bmdFormat8BitYUV.
Perhaps using a msleep or something else would be best because it uses a lot of CPU otherwise.
When I use bmdcapture I get a clean color bar in the output:
./bmdcapture -m 13 -C 0 -V 3 -F nut -f pipe:1|avconv -i - -q 5 -r 30 -f mpegts udp://239.192.2.15:1234
When I use avconv along with libbmd and disconnect the HDMI cable, the process load goes down. But If I restart the system or avconv (while HDMI is still disconnected) the process starts using 100%
/usr/local/bin/avconv -v trace -instance 0 -analyzeduration 0 -f bmd -video_mode 14 -audio_connection 2 -video_connection 3 -video_format 1 -i default -acodec mp2 -vcodec mpeg2video -threads 2 -qmin 5 -qmax 20 -q 8 -r 30 -f mpegts udp://239.192.2.15:1234
trace/debug doesn't not tell me if input is not detected.
I'm using a Decklink Mini Recorder