Example to capture video clip at 1080i50 10 bit:
ffmpeg -bm_v210 1 -f decklink -i 'UltraStudio Mini Recorder@11' -acodec copy -vcodec copy output.avi
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
... | ... |
@@ -233,6 +233,7 @@ HRESULT decklink_input_callback::VideoInputFrameArrived( |
233 | 233 |
ctx->video_st->time_base.den); |
234 | 234 |
|
235 | 235 |
if (videoFrame->GetFlags() & bmdFrameHasNoInputSource) { |
236 |
+ if (videoFrame->GetPixelFormat() == bmdFormat8BitYUV) { |
|
236 | 237 |
unsigned bars[8] = { |
237 | 238 |
0xEA80EA80, 0xD292D210, 0xA910A9A5, 0x90229035, |
238 | 239 |
0x6ADD6ACA, 0x51EF515A, 0x286D28EF, 0x10801080 }; |
... | ... |
@@ -244,6 +245,7 @@ HRESULT decklink_input_callback::VideoInputFrameArrived( |
244 | 244 |
for (int x = 0; x < width; x += 2) |
245 | 245 |
*p++ = bars[(x * 8) / width]; |
246 | 246 |
} |
247 |
+ } |
|
247 | 248 |
|
248 | 249 |
if (!no_video) { |
249 | 250 |
av_log(avctx, AV_LOG_WARNING, "Frame received (#%lu) - No input signal detected " |
... | ... |
@@ -466,15 +468,21 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx) |
466 | 466 |
goto error; |
467 | 467 |
} |
468 | 468 |
st->codec->codec_type = AVMEDIA_TYPE_VIDEO; |
469 |
- st->codec->codec_id = AV_CODEC_ID_RAWVIDEO; |
|
470 | 469 |
st->codec->width = ctx->bmd_width; |
471 | 470 |
st->codec->height = ctx->bmd_height; |
472 | 471 |
|
473 |
- st->codec->pix_fmt = AV_PIX_FMT_UYVY422; |
|
474 | 472 |
st->codec->time_base.den = ctx->bmd_tb_den; |
475 | 473 |
st->codec->time_base.num = ctx->bmd_tb_num; |
476 | 474 |
st->codec->bit_rate = avpicture_get_size(st->codec->pix_fmt, ctx->bmd_width, ctx->bmd_height) * 1/av_q2d(st->codec->time_base) * 8; |
477 |
- st->codec->codec_tag = MKTAG('U', 'Y', 'V', 'Y'); |
|
475 |
+ |
|
476 |
+ if (cctx->v210) { |
|
477 |
+ st->codec->codec_id = AV_CODEC_ID_V210; |
|
478 |
+ st->codec->codec_tag = MKTAG('V', '2', '1', '0'); |
|
479 |
+ } else { |
|
480 |
+ st->codec->codec_id = AV_CODEC_ID_RAWVIDEO; |
|
481 |
+ st->codec->pix_fmt = AV_PIX_FMT_UYVY422; |
|
482 |
+ st->codec->codec_tag = MKTAG('U', 'Y', 'V', 'Y'); |
|
483 |
+ } |
|
478 | 484 |
|
479 | 485 |
avpriv_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in us */ |
480 | 486 |
|
... | ... |
@@ -487,7 +495,9 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx) |
487 | 487 |
goto error; |
488 | 488 |
} |
489 | 489 |
|
490 |
- result = ctx->dli->EnableVideoInput(ctx->bmd_mode, bmdFormat8BitYUV, bmdVideoInputFlagDefault); |
|
490 |
+ result = ctx->dli->EnableVideoInput(ctx->bmd_mode, |
|
491 |
+ cctx->v210 ? bmdFormat10BitYUV : bmdFormat8BitYUV, |
|
492 |
+ bmdVideoInputFlagDefault); |
|
491 | 493 |
|
492 | 494 |
if (result != S_OK) { |
493 | 495 |
av_log(avctx, AV_LOG_ERROR, "Cannot enable video input\n"); |
... | ... |
@@ -31,6 +31,7 @@ |
31 | 31 |
static const AVOption options[] = { |
32 | 32 |
{ "list_devices", "list available devices" , OFFSET(list_devices), AV_OPT_TYPE_INT , { .i64 = 0 }, 0, 1, DEC }, |
33 | 33 |
{ "list_formats", "list supported formats" , OFFSET(list_formats), AV_OPT_TYPE_INT , { .i64 = 0 }, 0, 1, DEC }, |
34 |
+ { "bm_v210", "v210 10 bit per channel" , OFFSET(v210), AV_OPT_TYPE_INT , { .i64 = 0 }, 0, 1, DEC }, |
|
34 | 35 |
{ NULL }, |
35 | 36 |
}; |
36 | 37 |
|