vf_deshake.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562
  1. /*
  2. * Copyright (C) 2010 Georg Martius <georg.martius@web.de>
  3. * Copyright (C) 2010 Daniel G. Taylor <dan@programmer-art.org>
  4. *
  5. * This file is part of FFmpeg.
  6. *
  7. * FFmpeg is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * FFmpeg is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with FFmpeg; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. */
  21. /**
  22. * @file
  23. * fast deshake / depan video filter
  24. *
  25. * SAD block-matching motion compensation to fix small changes in
  26. * horizontal and/or vertical shift. This filter helps remove camera shake
  27. * from hand-holding a camera, bumping a tripod, moving on a vehicle, etc.
  28. *
  29. * Algorithm:
  30. * - For each frame with one previous reference frame
  31. * - For each block in the frame
  32. * - If contrast > threshold then find likely motion vector
  33. * - For all found motion vectors
  34. * - Find most common, store as global motion vector
  35. * - Find most likely rotation angle
  36. * - Transform image along global motion
  37. *
  38. * TODO:
  39. * - Fill frame edges based on previous/next reference frames
  40. * - Fill frame edges by stretching image near the edges?
  41. * - Can this be done quickly and look decent?
  42. *
  43. * Dark Shikari links to http://wiki.videolan.org/SoC_x264_2010#GPU_Motion_Estimation_2
  44. * for an algorithm similar to what could be used here to get the gmv
  45. * It requires only a couple diamond searches + fast downscaling
  46. *
  47. * Special thanks to Jason Kotenko for his help with the algorithm and my
  48. * inability to see simple errors in C code.
  49. */
  50. #include "avfilter.h"
  51. #include "formats.h"
  52. #include "video.h"
  53. #include "libavutil/common.h"
  54. #include "libavutil/mem.h"
  55. #include "libavutil/pixdesc.h"
  56. #include "libavcodec/dsputil.h"
  57. #include "transform.h"
  58. #define CHROMA_WIDTH(link) -((-link->w) >> av_pix_fmt_descriptors[link->format].log2_chroma_w)
  59. #define CHROMA_HEIGHT(link) -((-link->h) >> av_pix_fmt_descriptors[link->format].log2_chroma_h)
  60. enum SearchMethod {
  61. EXHAUSTIVE, ///< Search all possible positions
  62. SMART_EXHAUSTIVE, ///< Search most possible positions (faster)
  63. SEARCH_COUNT
  64. };
  65. typedef struct {
  66. int x; ///< Horizontal shift
  67. int y; ///< Vertical shift
  68. } IntMotionVector;
  69. typedef struct {
  70. double x; ///< Horizontal shift
  71. double y; ///< Vertical shift
  72. } MotionVector;
  73. typedef struct {
  74. MotionVector vector; ///< Motion vector
  75. double angle; ///< Angle of rotation
  76. double zoom; ///< Zoom percentage
  77. } Transform;
  78. typedef struct {
  79. AVClass av_class;
  80. AVFilterBufferRef *ref; ///< Previous frame
  81. int rx; ///< Maximum horizontal shift
  82. int ry; ///< Maximum vertical shift
  83. enum FillMethod edge; ///< Edge fill method
  84. int blocksize; ///< Size of blocks to compare
  85. int contrast; ///< Contrast threshold
  86. enum SearchMethod search; ///< Motion search method
  87. AVCodecContext *avctx;
  88. DSPContext c; ///< Context providing optimized SAD methods
  89. Transform last; ///< Transform from last frame
  90. int refcount; ///< Number of reference frames (defines averaging window)
  91. FILE *fp;
  92. Transform avg;
  93. int cw; ///< Crop motion search to this box
  94. int ch;
  95. int cx;
  96. int cy;
  97. } DeshakeContext;
  98. static int cmp(const double *a, const double *b)
  99. {
  100. return *a < *b ? -1 : ( *a > *b ? 1 : 0 );
  101. }
  102. /**
  103. * Cleaned mean (cuts off 20% of values to remove outliers and then averages)
  104. */
  105. static double clean_mean(double *values, int count)
  106. {
  107. double mean = 0;
  108. int cut = count / 5;
  109. int x;
  110. qsort(values, count, sizeof(double), (void*)cmp);
  111. for (x = cut; x < count - cut; x++) {
  112. mean += values[x];
  113. }
  114. return mean / (count - cut * 2);
  115. }
  116. /**
  117. * Find the most likely shift in motion between two frames for a given
  118. * macroblock. Test each block against several shifts given by the rx
  119. * and ry attributes. Searches using a simple matrix of those shifts and
  120. * chooses the most likely shift by the smallest difference in blocks.
  121. */
  122. static void find_block_motion(DeshakeContext *deshake, uint8_t *src1,
  123. uint8_t *src2, int cx, int cy, int stride,
  124. IntMotionVector *mv)
  125. {
  126. int x, y;
  127. int diff;
  128. int smallest = INT_MAX;
  129. int tmp, tmp2;
  130. #define CMP(i, j) deshake->c.sad[0](deshake, src1 + cy * stride + cx, \
  131. src2 + (j) * stride + (i), stride, \
  132. deshake->blocksize)
  133. if (deshake->search == EXHAUSTIVE) {
  134. // Compare every possible position - this is sloooow!
  135. for (y = -deshake->ry; y <= deshake->ry; y++) {
  136. for (x = -deshake->rx; x <= deshake->rx; x++) {
  137. diff = CMP(cx - x, cy - y);
  138. if (diff < smallest) {
  139. smallest = diff;
  140. mv->x = x;
  141. mv->y = y;
  142. }
  143. }
  144. }
  145. } else if (deshake->search == SMART_EXHAUSTIVE) {
  146. // Compare every other possible position and find the best match
  147. for (y = -deshake->ry + 1; y < deshake->ry - 2; y += 2) {
  148. for (x = -deshake->rx + 1; x < deshake->rx - 2; x += 2) {
  149. diff = CMP(cx - x, cy - y);
  150. if (diff < smallest) {
  151. smallest = diff;
  152. mv->x = x;
  153. mv->y = y;
  154. }
  155. }
  156. }
  157. // Hone in on the specific best match around the match we found above
  158. tmp = mv->x;
  159. tmp2 = mv->y;
  160. for (y = tmp2 - 1; y <= tmp2 + 1; y++) {
  161. for (x = tmp - 1; x <= tmp + 1; x++) {
  162. if (x == tmp && y == tmp2)
  163. continue;
  164. diff = CMP(cx - x, cy - y);
  165. if (diff < smallest) {
  166. smallest = diff;
  167. mv->x = x;
  168. mv->y = y;
  169. }
  170. }
  171. }
  172. }
  173. if (smallest > 512) {
  174. mv->x = -1;
  175. mv->y = -1;
  176. }
  177. emms_c();
  178. //av_log(NULL, AV_LOG_ERROR, "%d\n", smallest);
  179. //av_log(NULL, AV_LOG_ERROR, "Final: (%d, %d) = %d x %d\n", cx, cy, mv->x, mv->y);
  180. }
  181. /**
  182. * Find the contrast of a given block. When searching for global motion we
  183. * really only care about the high contrast blocks, so using this method we
  184. * can actually skip blocks we don't care much about.
  185. */
  186. static int block_contrast(uint8_t *src, int x, int y, int stride, int blocksize)
  187. {
  188. int highest = 0;
  189. int lowest = 0;
  190. int i, j, pos;
  191. for (i = 0; i <= blocksize * 2; i++) {
  192. // We use a width of 16 here to match the libavcodec sad functions
  193. for (j = 0; i <= 15; i++) {
  194. pos = (y - i) * stride + (x - j);
  195. if (src[pos] < lowest)
  196. lowest = src[pos];
  197. else if (src[pos] > highest) {
  198. highest = src[pos];
  199. }
  200. }
  201. }
  202. return highest - lowest;
  203. }
  204. /**
  205. * Find the rotation for a given block.
  206. */
  207. static double block_angle(int x, int y, int cx, int cy, IntMotionVector *shift)
  208. {
  209. double a1, a2, diff;
  210. a1 = atan2(y - cy, x - cx);
  211. a2 = atan2(y - cy + shift->y, x - cx + shift->x);
  212. diff = a2 - a1;
  213. return (diff > M_PI) ? diff - 2 * M_PI :
  214. (diff < -M_PI) ? diff + 2 * M_PI :
  215. diff;
  216. }
  217. /**
  218. * Find the estimated global motion for a scene given the most likely shift
  219. * for each block in the frame. The global motion is estimated to be the
  220. * same as the motion from most blocks in the frame, so if most blocks
  221. * move one pixel to the right and two pixels down, this would yield a
  222. * motion vector (1, -2).
  223. */
  224. static void find_motion(DeshakeContext *deshake, uint8_t *src1, uint8_t *src2,
  225. int width, int height, int stride, Transform *t)
  226. {
  227. int x, y;
  228. IntMotionVector mv = {0, 0};
  229. int counts[128][128];
  230. int count_max_value = 0;
  231. int contrast;
  232. int pos;
  233. double *angles = av_malloc(sizeof(*angles) * width * height / (16 * deshake->blocksize));
  234. int center_x = 0, center_y = 0;
  235. double p_x, p_y;
  236. // Reset counts to zero
  237. for (x = 0; x < deshake->rx * 2 + 1; x++) {
  238. for (y = 0; y < deshake->ry * 2 + 1; y++) {
  239. counts[x][y] = 0;
  240. }
  241. }
  242. pos = 0;
  243. // Find motion for every block and store the motion vector in the counts
  244. for (y = deshake->ry; y < height - deshake->ry - (deshake->blocksize * 2); y += deshake->blocksize * 2) {
  245. // We use a width of 16 here to match the libavcodec sad functions
  246. for (x = deshake->rx; x < width - deshake->rx - 16; x += 16) {
  247. // If the contrast is too low, just skip this block as it probably
  248. // won't be very useful to us.
  249. contrast = block_contrast(src2, x, y, stride, deshake->blocksize);
  250. if (contrast > deshake->contrast) {
  251. //av_log(NULL, AV_LOG_ERROR, "%d\n", contrast);
  252. find_block_motion(deshake, src1, src2, x, y, stride, &mv);
  253. if (mv.x != -1 && mv.y != -1) {
  254. counts[mv.x + deshake->rx][mv.y + deshake->ry] += 1;
  255. if (x > deshake->rx && y > deshake->ry)
  256. angles[pos++] = block_angle(x, y, 0, 0, &mv);
  257. center_x += mv.x;
  258. center_y += mv.y;
  259. }
  260. }
  261. }
  262. }
  263. if (pos) {
  264. center_x /= pos;
  265. center_y /= pos;
  266. t->angle = clean_mean(angles, pos);
  267. if (t->angle < 0.001)
  268. t->angle = 0;
  269. } else {
  270. t->angle = 0;
  271. }
  272. // Find the most common motion vector in the frame and use it as the gmv
  273. for (y = deshake->ry * 2; y >= 0; y--) {
  274. for (x = 0; x < deshake->rx * 2 + 1; x++) {
  275. //av_log(NULL, AV_LOG_ERROR, "%5d ", counts[x][y]);
  276. if (counts[x][y] > count_max_value) {
  277. t->vector.x = x - deshake->rx;
  278. t->vector.y = y - deshake->ry;
  279. count_max_value = counts[x][y];
  280. }
  281. }
  282. //av_log(NULL, AV_LOG_ERROR, "\n");
  283. }
  284. p_x = (center_x - width / 2.0);
  285. p_y = (center_y - height / 2.0);
  286. t->vector.x += (cos(t->angle)-1)*p_x - sin(t->angle)*p_y;
  287. t->vector.y += sin(t->angle)*p_x + (cos(t->angle)-1)*p_y;
  288. // Clamp max shift & rotation?
  289. t->vector.x = av_clipf(t->vector.x, -deshake->rx * 2, deshake->rx * 2);
  290. t->vector.y = av_clipf(t->vector.y, -deshake->ry * 2, deshake->ry * 2);
  291. t->angle = av_clipf(t->angle, -0.1, 0.1);
  292. //av_log(NULL, AV_LOG_ERROR, "%d x %d\n", avg->x, avg->y);
  293. av_free(angles);
  294. }
  295. static av_cold int init(AVFilterContext *ctx, const char *args)
  296. {
  297. DeshakeContext *deshake = ctx->priv;
  298. char filename[256] = {0};
  299. deshake->rx = 16;
  300. deshake->ry = 16;
  301. deshake->edge = FILL_MIRROR;
  302. deshake->blocksize = 8;
  303. deshake->contrast = 125;
  304. deshake->search = EXHAUSTIVE;
  305. deshake->refcount = 20;
  306. deshake->cw = -1;
  307. deshake->ch = -1;
  308. deshake->cx = -1;
  309. deshake->cy = -1;
  310. if (args) {
  311. sscanf(args, "%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%255s",
  312. &deshake->cx, &deshake->cy, &deshake->cw, &deshake->ch,
  313. &deshake->rx, &deshake->ry, (int *)&deshake->edge,
  314. &deshake->blocksize, &deshake->contrast, (int *)&deshake->search, filename);
  315. deshake->blocksize /= 2;
  316. deshake->rx = av_clip(deshake->rx, 0, 64);
  317. deshake->ry = av_clip(deshake->ry, 0, 64);
  318. deshake->edge = av_clip(deshake->edge, FILL_BLANK, FILL_COUNT - 1);
  319. deshake->blocksize = av_clip(deshake->blocksize, 4, 128);
  320. deshake->contrast = av_clip(deshake->contrast, 1, 255);
  321. deshake->search = av_clip(deshake->search, EXHAUSTIVE, SEARCH_COUNT - 1);
  322. }
  323. if (*filename)
  324. deshake->fp = fopen(filename, "w");
  325. if (deshake->fp)
  326. fwrite("Ori x, Avg x, Fin x, Ori y, Avg y, Fin y, Ori angle, Avg angle, Fin angle, Ori zoom, Avg zoom, Fin zoom\n", sizeof(char), 104, deshake->fp);
  327. // Quadword align left edge of box for MMX code, adjust width if necessary
  328. // to keep right margin
  329. if (deshake->cx > 0) {
  330. deshake->cw += deshake->cx - (deshake->cx & ~15);
  331. deshake->cx &= ~15;
  332. }
  333. av_log(ctx, AV_LOG_VERBOSE, "cx: %d, cy: %d, cw: %d, ch: %d, rx: %d, ry: %d, edge: %d blocksize: %d contrast: %d search: %d\n",
  334. deshake->cx, deshake->cy, deshake->cw, deshake->ch,
  335. deshake->rx, deshake->ry, deshake->edge, deshake->blocksize * 2, deshake->contrast, deshake->search);
  336. return 0;
  337. }
  338. static int query_formats(AVFilterContext *ctx)
  339. {
  340. enum PixelFormat pix_fmts[] = {
  341. PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_YUV444P, PIX_FMT_YUV410P,
  342. PIX_FMT_YUV411P, PIX_FMT_YUV440P, PIX_FMT_YUVJ420P, PIX_FMT_YUVJ422P,
  343. PIX_FMT_YUVJ444P, PIX_FMT_YUVJ440P, PIX_FMT_NONE
  344. };
  345. ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
  346. return 0;
  347. }
  348. static int config_props(AVFilterLink *link)
  349. {
  350. DeshakeContext *deshake = link->dst->priv;
  351. deshake->ref = NULL;
  352. deshake->last.vector.x = 0;
  353. deshake->last.vector.y = 0;
  354. deshake->last.angle = 0;
  355. deshake->last.zoom = 0;
  356. deshake->avctx = avcodec_alloc_context3(NULL);
  357. dsputil_init(&deshake->c, deshake->avctx);
  358. return 0;
  359. }
  360. static av_cold void uninit(AVFilterContext *ctx)
  361. {
  362. DeshakeContext *deshake = ctx->priv;
  363. avfilter_unref_buffer(deshake->ref);
  364. if (deshake->fp)
  365. fclose(deshake->fp);
  366. if (deshake->avctx)
  367. avcodec_close(deshake->avctx);
  368. av_freep(&deshake->avctx);
  369. }
  370. static int end_frame(AVFilterLink *link)
  371. {
  372. DeshakeContext *deshake = link->dst->priv;
  373. AVFilterBufferRef *in = link->cur_buf;
  374. AVFilterBufferRef *out = link->dst->outputs[0]->out_buf;
  375. Transform t = {{0},0}, orig = {{0},0};
  376. float matrix[9];
  377. float alpha = 2.0 / deshake->refcount;
  378. char tmp[256];
  379. link->cur_buf = NULL; /* it is in 'in' now */
  380. if (deshake->cx < 0 || deshake->cy < 0 || deshake->cw < 0 || deshake->ch < 0) {
  381. // Find the most likely global motion for the current frame
  382. find_motion(deshake, (deshake->ref == NULL) ? in->data[0] : deshake->ref->data[0], in->data[0], link->w, link->h, in->linesize[0], &t);
  383. } else {
  384. uint8_t *src1 = (deshake->ref == NULL) ? in->data[0] : deshake->ref->data[0];
  385. uint8_t *src2 = in->data[0];
  386. deshake->cx = FFMIN(deshake->cx, link->w);
  387. deshake->cy = FFMIN(deshake->cy, link->h);
  388. if ((unsigned)deshake->cx + (unsigned)deshake->cw > link->w) deshake->cw = link->w - deshake->cx;
  389. if ((unsigned)deshake->cy + (unsigned)deshake->ch > link->h) deshake->ch = link->h - deshake->cy;
  390. // Quadword align right margin
  391. deshake->cw &= ~15;
  392. src1 += deshake->cy * in->linesize[0] + deshake->cx;
  393. src2 += deshake->cy * in->linesize[0] + deshake->cx;
  394. find_motion(deshake, src1, src2, deshake->cw, deshake->ch, in->linesize[0], &t);
  395. }
  396. // Copy transform so we can output it later to compare to the smoothed value
  397. orig.vector.x = t.vector.x;
  398. orig.vector.y = t.vector.y;
  399. orig.angle = t.angle;
  400. orig.zoom = t.zoom;
  401. // Generate a one-sided moving exponential average
  402. deshake->avg.vector.x = alpha * t.vector.x + (1.0 - alpha) * deshake->avg.vector.x;
  403. deshake->avg.vector.y = alpha * t.vector.y + (1.0 - alpha) * deshake->avg.vector.y;
  404. deshake->avg.angle = alpha * t.angle + (1.0 - alpha) * deshake->avg.angle;
  405. deshake->avg.zoom = alpha * t.zoom + (1.0 - alpha) * deshake->avg.zoom;
  406. // Remove the average from the current motion to detect the motion that
  407. // is not on purpose, just as jitter from bumping the camera
  408. t.vector.x -= deshake->avg.vector.x;
  409. t.vector.y -= deshake->avg.vector.y;
  410. t.angle -= deshake->avg.angle;
  411. t.zoom -= deshake->avg.zoom;
  412. // Invert the motion to undo it
  413. t.vector.x *= -1;
  414. t.vector.y *= -1;
  415. t.angle *= -1;
  416. // Write statistics to file
  417. if (deshake->fp) {
  418. snprintf(tmp, 256, "%f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f\n", orig.vector.x, deshake->avg.vector.x, t.vector.x, orig.vector.y, deshake->avg.vector.y, t.vector.y, orig.angle, deshake->avg.angle, t.angle, orig.zoom, deshake->avg.zoom, t.zoom);
  419. fwrite(tmp, sizeof(char), strlen(tmp), deshake->fp);
  420. }
  421. // Turn relative current frame motion into absolute by adding it to the
  422. // last absolute motion
  423. t.vector.x += deshake->last.vector.x;
  424. t.vector.y += deshake->last.vector.y;
  425. t.angle += deshake->last.angle;
  426. t.zoom += deshake->last.zoom;
  427. // Shrink motion by 10% to keep things centered in the camera frame
  428. t.vector.x *= 0.9;
  429. t.vector.y *= 0.9;
  430. t.angle *= 0.9;
  431. // Store the last absolute motion information
  432. deshake->last.vector.x = t.vector.x;
  433. deshake->last.vector.y = t.vector.y;
  434. deshake->last.angle = t.angle;
  435. deshake->last.zoom = t.zoom;
  436. // Generate a luma transformation matrix
  437. avfilter_get_matrix(t.vector.x, t.vector.y, t.angle, 1.0 + t.zoom / 100.0, matrix);
  438. // Transform the luma plane
  439. avfilter_transform(in->data[0], out->data[0], in->linesize[0], out->linesize[0], link->w, link->h, matrix, INTERPOLATE_BILINEAR, deshake->edge);
  440. // Generate a chroma transformation matrix
  441. avfilter_get_matrix(t.vector.x / (link->w / CHROMA_WIDTH(link)), t.vector.y / (link->h / CHROMA_HEIGHT(link)), t.angle, 1.0 + t.zoom / 100.0, matrix);
  442. // Transform the chroma planes
  443. avfilter_transform(in->data[1], out->data[1], in->linesize[1], out->linesize[1], CHROMA_WIDTH(link), CHROMA_HEIGHT(link), matrix, INTERPOLATE_BILINEAR, deshake->edge);
  444. avfilter_transform(in->data[2], out->data[2], in->linesize[2], out->linesize[2], CHROMA_WIDTH(link), CHROMA_HEIGHT(link), matrix, INTERPOLATE_BILINEAR, deshake->edge);
  445. // Store the current frame as the reference frame for calculating the
  446. // motion of the next frame
  447. if (deshake->ref != NULL)
  448. avfilter_unref_buffer(deshake->ref);
  449. // Cleanup the old reference frame
  450. deshake->ref = in;
  451. // Draw the transformed frame information
  452. ff_draw_slice(link->dst->outputs[0], 0, link->h, 1);
  453. return ff_end_frame(link->dst->outputs[0]);
  454. }
  455. static int draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
  456. {
  457. return 0;
  458. }
  459. AVFilter avfilter_vf_deshake = {
  460. .name = "deshake",
  461. .description = NULL_IF_CONFIG_SMALL("Stabilize shaky video."),
  462. .priv_size = sizeof(DeshakeContext),
  463. .init = init,
  464. .uninit = uninit,
  465. .query_formats = query_formats,
  466. .inputs = (const AVFilterPad[]) {{ .name = "default",
  467. .type = AVMEDIA_TYPE_VIDEO,
  468. .draw_slice = draw_slice,
  469. .end_frame = end_frame,
  470. .config_props = config_props,
  471. .min_perms = AV_PERM_READ | AV_PERM_PRESERVE, },
  472. { .name = NULL}},
  473. .outputs = (const AVFilterPad[]) {{ .name = "default",
  474. .type = AVMEDIA_TYPE_VIDEO, },
  475. { .name = NULL}},
  476. };