Unified · Split
| @@ -233,6 +233,12 @@ Defaults to @option{false}. · 232 unmodified lines | ||
| 233 | 233 | If set to @option{true}, print a list of supported formats and exit. |
| 234 | 234 | Defaults to @option{false}. |
| 235 | 235 | |
| 236 | +@item format_code <FourCC> | |
| 237 | +This sets the input video format to the format given by the FourCC. To see | |
| 238 | +the supported values of your device(s) use @option{list_formats}. | |
| 239 | +Note that there is a FourCC @option{'pal '} that can also be used | |
| 240 | +as @option{pal} (3 letters). | |
| 241 | + | |
| 236 | 242 | @item bm_v210 |
| 237 | 243 | If set to @samp{1}, video is captured in 10 bit v210 instead |
| 238 | 244 | of uyvy422. Not all Blackmagic devices support this option. |
| @@ -296,21 +302,21 @@ ffmpeg -f decklink -list_formats 1 -i 'Intensity Pro' · 57 unmodified lines | ||
| 296 | 302 | @end example |
| 297 | 303 | |
| 298 | 304 | @item |
| 299 | −Capture video clip at 1080i50 (format 11): | |
| 305 | +Capture video clip at 1080i50: | |
| 300 | 306 | @example |
| 301 | −ffmpeg -f decklink -i 'Intensity Pro@@11' -acodec copy -vcodec copy output.avi | |
| 307 | +ffmpeg -format_code Hi50 -f decklink -i 'Intensity Pro' -acodec copy -vcodec copy output.avi | |
| 302 | 308 | @end example |
| 303 | 309 | |
| 304 | 310 | @item |
| 305 | 311 | Capture video clip at 1080i50 10 bit: |
| 306 | 312 | @example |
| 307 | −ffmpeg -bm_v210 1 -f decklink -i 'UltraStudio Mini Recorder@@11' -acodec copy -vcodec copy output.avi | |
| 313 | +ffmpeg -bm_v210 1 -format_code Hi50 -f decklink -i 'UltraStudio Mini Recorder' -acodec copy -vcodec copy output.avi | |
| 308 | 314 | @end example |
| 309 | 315 | |
| 310 | 316 | @item |
| 311 | 317 | Capture video clip at 1080i50 with 16 audio channels: |
| 312 | 318 | @example |
| 313 | −ffmpeg -channels 16 -f decklink -i 'UltraStudio Mini Recorder@@11' -acodec copy -vcodec copy output.avi | |
| 319 | +ffmpeg -channels 16 -format_code Hi50 -f decklink -i 'UltraStudio Mini Recorder' -acodec copy -vcodec copy output.avi | |
| 314 | 320 | @end example |
| 315 | 321 | |
| 316 | 322 | @end itemize |
| @@ -33,6 +33,7 @@ extern "C" { · 32 unmodified lines | ||
| 33 | 33 | #include "libavformat/avformat.h" |
| 34 | 34 | #include "libavformat/internal.h" |
| 35 | 35 | #include "libavutil/imgutils.h" |
| 36 | +#include "libavutil/intreadwrite.h" | |
| 36 | 37 | #include "libavutil/bswap.h" |
| 37 | 38 | } |
| 38 | 39 | |
| @@ -158,8 +159,8 @@ int ff_decklink_set_format(AVFormatContext *avctx, · 119 unmodified lines | ||
| 158 | 159 | int i = 1; |
| 159 | 160 | HRESULT res; |
| 160 | 161 | |
| 161 | − av_log(avctx, AV_LOG_DEBUG, "Trying to find mode for frame size %dx%d, frame timing %d/%d, field order %d, direction %d, mode number %d\n", | |
| 162 | − width, height, tb_num, tb_den, field_order, direction, num); | |
| 162 | + av_log(avctx, AV_LOG_DEBUG, "Trying to find mode for frame size %dx%d, frame timing %d/%d, field order %d, direction %d, mode number %d, format code %s\n", | |
| 163 | + width, height, tb_num, tb_den, field_order, direction, num, (cctx->format_code) ? cctx->format_code : "(unset)"); | |
| 163 | 164 | |
| 164 | 165 | if (ctx->duplex_mode) { |
| 165 | 166 | DECKLINK_BOOL duplex_supported = false; |
| @@ -196,12 +197,17 @@ int ff_decklink_set_format(AVFormatContext *avctx, · 30 unmodified lines | ||
| 196 | 197 | return AVERROR(EIO); |
| 197 | 198 | } |
| 198 | 199 | |
| 200 | + char format_buf[] = " "; | |
| 201 | + if (cctx->format_code) | |
| 202 | + memcpy(format_buf, cctx->format_code, FFMIN(strlen(cctx->format_code), sizeof(format_buf))); | |
| 203 | + BMDDisplayMode target_mode = (BMDDisplayMode)AV_RB32(format_buf); | |
| 199 | 204 | AVRational target_tb = av_make_q(tb_num, tb_den); |
| 200 | 205 | ctx->bmd_mode = bmdModeUnknown; |
| 201 | 206 | while ((ctx->bmd_mode == bmdModeUnknown) && itermode->Next(&mode) == S_OK) { |
| 202 | 207 | BMDTimeValue bmd_tb_num, bmd_tb_den; |
| 203 | 208 | int bmd_width = mode->GetWidth(); |
| 204 | 209 | int bmd_height = mode->GetHeight(); |
| 210 | + BMDDisplayMode bmd_mode = mode->GetDisplayMode(); | |
| 205 | 211 | BMDFieldDominance bmd_field_dominance = mode->GetFieldDominance(); |
| 206 | 212 | |
| 207 | 213 | mode->GetFrameRate(&bmd_tb_num, &bmd_tb_den); |
| @@ -210,8 +216,10 @@ int ff_decklink_set_format(AVFormatContext *avctx, · 2 unmodified lines | ||
| 210 | 216 | if ((bmd_width == width && |
| 211 | 217 | bmd_height == height && |
| 212 | 218 | !av_cmp_q(mode_tb, target_tb) && |
| 213 | − field_order_eq(field_order, bmd_field_dominance)) || i == num) { | |
| 214 | − ctx->bmd_mode = mode->GetDisplayMode(); | |
| 219 | + field_order_eq(field_order, bmd_field_dominance)) | |
| 220 | + || i == num | |
| 221 | + || target_mode == bmd_mode) { | |
| 222 | + ctx->bmd_mode = bmd_mode; | |
| 215 | 223 | ctx->bmd_width = bmd_width; |
| 216 | 224 | ctx->bmd_height = bmd_height; |
| 217 | 225 | ctx->bmd_tb_den = bmd_tb_den; |
| @@ -47,6 +47,7 @@ struct decklink_cctx { · 46 unmodified lines | ||
| 47 | 47 | int audio_input; |
| 48 | 48 | int video_input; |
| 49 | 49 | int draw_bars; |
| 50 | + char *format_code; | |
| 50 | 51 | }; |
| 51 | 52 | |
| 52 | 53 | #endif /* AVDEVICE_DECKLINK_COMMON_C_H */ |
| @@ -539,9 +539,10 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx) · 538 unmodified lines | ||
| 539 | 539 | goto error; |
| 540 | 540 | } |
| 541 | 541 | |
| 542 | − if (mode_num > 0) { | |
| 542 | + if (mode_num > 0 || cctx->format_code) { | |
| 543 | 543 | if (ff_decklink_set_format(avctx, DIRECTION_IN, mode_num) < 0) { |
| 544 | − av_log(avctx, AV_LOG_ERROR, "Could not set mode %d for %s\n", mode_num, fname); | |
| 544 | + av_log(avctx, AV_LOG_ERROR, "Could not set mode number %d or format code %s for %s\n", | |
| 545 | + mode_num, (cctx->format_code) ? cctx->format_code : "(unset)", fname); | |
| 545 | 546 | ret = AVERROR(EIO); |
| 546 | 547 | goto error; |
| 547 | 548 | } |
| @@ -31,6 +31,7 @@ · 30 unmodified lines | ||
| 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 | + { "format_code", "set format by fourcc" , OFFSET(format_code), AV_OPT_TYPE_STRING, { .str = NULL}, 0, 0, DEC }, | |
| 34 | 35 | { "bm_v210", "v210 10 bit per channel" , OFFSET(v210), AV_OPT_TYPE_INT , { .i64 = 0 }, 0, 1, DEC }, |
| 35 | 36 | { "teletext_lines", "teletext lines bitmask", OFFSET(teletext_lines), AV_OPT_TYPE_INT64, { .i64 = 0 }, 0, 0x7ffffffffLL, DEC, "teletext_lines"}, |
| 36 | 37 | { "standard", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0x7fff9fffeLL}, 0, 0, DEC, "teletext_lines"}, |
| @@ -29,7 +29,7 @@ · 28 unmodified lines | ||
| 29 | 29 | |
| 30 | 30 | #define LIBAVDEVICE_VERSION_MAJOR 57 |
| 31 | 31 | #define LIBAVDEVICE_VERSION_MINOR 3 |
| 32 | −#define LIBAVDEVICE_VERSION_MICRO 100 | |
| 32 | +#define LIBAVDEVICE_VERSION_MICRO 101 | |
| 33 | 33 | |
| 34 | 34 | #define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \ |
| 35 | 35 | LIBAVDEVICE_VERSION_MINOR, \ |