#4407: Blackmagic/video signal to v4l2 loopback device has hickups -------------------------------------+------------------------------------- Reporter: thecas | Type: defect Status: new | Priority: normal Component: | Version: undetermined | unspecified Keywords: v4l2, | Blocked By: v4l2loopback, decklink | Reproduced by developer: 0 Blocking: | Analyzed by developer: 0 | -------------------------------------+------------------------------------- Summary of the bug: I try to use a v4l2 loopback device for playback my Blackmagic Decklink card but the video stalls multiple times per second. When I playback a video to the device {{{ffmpeg -re -i bbb_sunflower_1080p_30fps_normal.mp4 -f v4l2 /dev/video0}}} it looks fine. Also when I record my bmd device to a video file {{{ffmpeg -f decklink -i DeckLink\ SDI\ \(1\)@8 output.mkv}}} I get a great result. But the combination BMD->V4l2loopback seems lagging.
I tried to play with -rtbufsize, -vsync, bmdtools and piping through the matroska container but none seem the solution. How to reproduce: {{{ $ ffmpeg -v 9 -loglevel 99 -f decklink -i DeckLink\ SDI\ \(1\)@8 -f v4l2 /dev/video0 ffmpeg version N-71087-g589a604 Copyright (c) 2000-2015 the FFmpeg developers built with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1) configuration: --enable-libxcb --enable-libxcb-shm --disable-libxcb- xfixes --disable-libxcb-shape --enable-decklink --enable-gpl --enable- libx264 --extra-cflags='-I /home/pluxbox/blackmagic/sdk/Linux/include' --extra-libs=-ldl libavutil 54. 20.101 / 54. 20.101 libavcodec 56. 30.100 / 56. 30.100 libavformat 56. 26.101 / 56. 26.101 libavdevice 56. 4.100 / 56. 4.100 libavfilter 5. 13.101 / 5. 13.101 libswscale 3. 1.101 / 3. 1.101 libswresample 1. 1.100 / 1. 1.100 libpostproc 53. 3.100 / 53. 3.100 Splitting the commandline. Reading option '-v' ... matched as option 'v' (set logging level) with argument '9'. Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument '99'. Reading option '-f' ... matched as option 'f' (force format) with argument 'decklink'. Reading option '-i' ... matched as input file with argument 'DeckLink SDI (1)@8'. Reading option '-f' ... matched as option 'f' (force format) with argument 'v4l2'. Reading option '/dev/video0' ... matched as output file. Finished splitting the commandline. Parsing a group of options: global . Applying option v (set logging level) with argument 9. Successfully parsed a group of options. Parsing a group of options: input file DeckLink SDI (1)@8. Applying option f (force format) with argument decklink. Successfully parsed a group of options. Opening an input file: DeckLink SDI (1)@8. [decklink @ 0x2b1d140] Found Decklink mode 1920 x 1080 with rate 30.00 [decklink @ 0x2b1d140] Frame received (#1) - No input signal detected - Frames dropped 1 [decklink @ 0x2b1d140] All info found Guessed Channel Layout for Input Stream #0.0 : stereo Input #0, decklink, from 'DeckLink SDI (1)@8': Duration: N/A, start: 0.000000, bitrate: 1536 kb/s Stream #0:0, 1, 1/1000000: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s Stream #0:1, 1, 1/1000000: Video: rawvideo, 1 reference frame (UYVY / 0x59565955), uyvy422, 1920x1080, 1/30, -5 kb/s, 30 tbr, 1000k tbn, 30 tbc Successfully opened the file. Parsing a group of options: output file /dev/video0. Applying option f (force format) with argument v4l2. Successfully parsed a group of options. Opening an output file: /dev/video0. Successfully opened the file. detected 4 logical cores [graph 0 input from stream 0:1 @ 0x2b08420] Setting 'video_size' to value '1920x1080' [graph 0 input from stream 0:1 @ 0x2b08420] Setting 'pix_fmt' to value '17' [graph 0 input from stream 0:1 @ 0x2b08420] Setting 'time_base' to value '1/1000000' [graph 0 input from stream 0:1 @ 0x2b08420] Setting 'pixel_aspect' to value '0/1' [graph 0 input from stream 0:1 @ 0x2b08420] Setting 'sws_param' to value 'flags=2' [graph 0 input from stream 0:1 @ 0x2b08420] Setting 'frame_rate' to value '30000/1000' [graph 0 input from stream 0:1 @ 0x2b08420] w:1920 h:1080 pixfmt:uyvy422 tb:1/1000000 fr:30000/1000 sar:0/1 sws_param:flags=2 [AVFilterGraph @ 0x2b128c0] query_formats: 3 queried, 2 merged, 0 already done, 0 delayed Output #0, v4l2, to '/dev/video0': Metadata: encoder : Lavf56.26.101 Stream #0:0, 0, 1/30: Video: rawvideo, 1 reference frame (UYVY / 0x59565955), uyvy422, 1920x1080, 1/30, q=2-31, 200 kb/s, 30 fps, 30 tbn, 30 tbc Metadata: encoder : Lavc56.30.100 rawvideo Stream mapping: Stream #0:1 -> #0:0 (rawvideo (native) -> rawvideo (native)) Press [q] to stop, [?] for help Cliping frame in rate conversion by 0.000008 [decklink @ 0x2b1d140] Frame received (#2) - Input returned - Frames dropped 2 *** 16 dup! Cliping frame in rate conversion by 0.0000230:00.60 bitrate=N/A dup=16 drop=0 Last message repeated 3 times Cliping frame in rate conversion by 0.0000230:01.03 bitrate=N/A dup=16 drop=0 Last message repeated 2 times [decklink @ 0x2b1d140] Frame received (#25) - Valid (4147200B) - QSize 0.006203MB Cliping frame in rate conversion by 0.0000230:01.33 bitrate=N/A dup=16 drop=0 Last message repeated 4 times Cliping frame in rate conversion by 0.0000230:01.86 bitrate=N/A dup=16 drop=0 [decklink @ 0x2b1d140] Frame received (#50) - Valid (4147200B) - QSize 23.774483MB Cliping frame in rate conversion by 0.000023 Last message repeated 4 times Cliping frame in rate conversion by 0.0000230:02.43 bitrate=N/A dup=16 drop=0 Last message repeated 4 times [decklink @ 0x2b1d140] Frame received (#75) - Valid (4147200B) - QSize 3.967583MB Cliping frame in rate conversion by 0.0000230:02.96 bitrate=N/A dup=16 drop=0 Last message repeated 5 times Cliping frame in rate conversion by 0.0000230:03.50 bitrate=N/A dup=16 drop=0 [decklink @ 0x2b1d140] Frame received (#100) - Valid (4147200B) - QSize 23.774483MB Cliping frame in rate conversion by 0.000023 Last message repeated 3 times Cliping frame in rate conversion by 0.0000230:04.06 bitrate=N/A dup=16 drop=0 Last message repeated 5 times [decklink @ 0x2b1d140] Frame received (#125) - Valid (4147200B) - QSize 7.922760MB Cliping frame in rate conversion by 0.000023 Last message repeated 4 times Cliping frame in rate conversion by 0.0000230:05.16 bitrate=N/A dup=16 drop=0 Last message repeated 1 times [decklink @ 0x2b1d140] Frame received (#150) - Valid (4147200B) - QSize 23.774483MB Cliping frame in rate conversion by 0.000023 Last message repeated 3 times Cliping frame in rate conversion by 0.0000230:05.70 bitrate=N/A dup=16 drop=0 Last message repeated 4 times [decklink @ 0x2b1d140] Frame received (#175) - Valid (4147200B) - QSize 7.928963MB Cliping frame in rate conversion by 0.000023 Last message repeated 5 times Cliping frame in rate conversion by 0.0000230:06.80 bitrate=N/A dup=16 drop=0 [decklink @ 0x2b1d140] Frame received (#200) - Valid (4147200B) - QSize 27.735863MB Cliping frame in rate conversion by 0.000023 Last message repeated 3 times Cliping frame in rate conversion by 0.0000230:07.33 bitrate=N/A dup=16 drop=0 Last message repeated 4 times Cliping frame in rate conversion by 0.0000230:07.86 bitrate=N/A dup=16 drop=0 [decklink @ 0x2b1d140] Frame received (#225) - Valid (4147200B) - QSize 11.890343MB Cliping frame in rate conversion by 0.000023 Last message repeated 4 times Cliping frame in rate conversion by 0.0000230:08.43 bitrate=N/A dup=16 drop=0 Last message repeated 1 times [decklink @ 0x2b1d140] Frame received (#250) - Valid (4147200B) - QSize 27.735863MB Cliping frame in rate conversion by 0.000023 Last message repeated 2 times Cliping frame in rate conversion by 0.0000230:08.96 bitrate=N/A dup=16 drop=0 Last message repeated 5 times frame= 286 fps= 29 q=0.0 Lsize=N/A time=00:00:09.53 bitrate=N/A dup=16 drop=0 video:1158300kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown Input file #0 (DeckLink SDI (1)@8): Input stream #0:0 (audio): 269 packets read (1721600 bytes); Input stream #0:1 (video): 270 packets read (1119744000 bytes); 270 frames decoded; Total: 539 packets (1121465600 bytes) demuxed Output file #0 (/dev/video0): Output stream #0:0 (video): 286 frames encoded; 286 packets muxed (1186099200 bytes); Total: 286 packets (1186099200 bytes) muxed 270 frames successfully decoded, 0 decoding errors Received signal 2: terminating. }}} The dub frames seems stable after initialization, the load of the computer is 0.3 and the memory is 90% free. When I playback my /dev/video0 with mpv `mpv tv://` I get the following errors (the seems sync with the frame freeze): Non-monotonic video pts: 0.000000 <= 0.00000 --no-correct-pts with mpv omits the errors but not solve the problem. Hopefully someone has some ideas. -- Ticket URL: <https://trac.ffmpeg.org/ticket/4407> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker _______________________________________________ FFmpeg-trac mailing list FFmpeg-trac@avcodec.org http://avcodec.org/mailman/listinfo/ffmpeg-trac