[FFmpeg-devel] [PATCH] Limited timecode support for lavd/decklink

Dave Rice dave at dericed.com
Thu May 31 22:39:15 EEST 2018


Hi Jonathan,

> On May 31, 2018, at 11:41 AM, Jonathan Morley <jmorley at pixsystem.com> wrote:
> 
> Thank you very much, Dave. I am really curious about the df vs ndf since the Blackmagic SDK call I am making doesn’t have any arguments for specifying that kind of distinction. It simply returns what it finds in the SDI stream.

I know have a tape known to be NDF and a tape known to be DF. The messages I sent before were from DF tapes. When I tried a NDF tape, I get the "Unable to find timecode” warning repeatedly and no timecode on the output file.

./ffmpeg -timecode_format vitc2 -f decklink -draw_bars 0 -audio_input embedded -video_input sdi -format_code ntsc -channels 8 -raw_format yuv422p10 -i "UltraStudio 3D" -c:v v210 -c:a aac devlin5.mov
ffmpeg version N-91200-g1616b1be5a Copyright (c) 2000-2018 the FFmpeg developers
  built with Apple LLVM version 9.0.0 (clang-900.0.38)
  configuration: --enable-nonfree --enable-decklink --extra-cflags=-I/usr/local/include --extra-ldflags=-L/usr/local/include
  libavutil      56. 18.102 / 56. 18.102
  libavcodec     58. 19.104 / 58. 19.104
  libavformat    58. 17.100 / 58. 17.100
  libavdevice    58.  4.100 / 58.  4.100
  libavfilter     7. 24.100 /  7. 24.100
  libswscale      5.  2.100 /  5.  2.100
  libswresample   3.  2.100 /  3.  2.100
[decklink @ 0x7f9f66800000] Found Decklink mode 720 x 486 with rate 29.97(i)
[decklink @ 0x7f9f66800000] Unable to find timecode.
    Last message repeated 5 times
Guessed Channel Layout for Input Stream #0.0 : 7.1
Input #0, decklink, from 'UltraStudio 3D':
  Duration: N/A, start: 0.000000, bitrate: 229869 kb/s
    Stream #0:0: Audio: pcm_s16le, 48000 Hz, 7.1, s16, 6144 kb/s
    Stream #0:1: Video: v210 (V210 / 0x30313256), yuv422p10le(bottom first), 720x486, 223725 kb/s, 29.97 fps, 29.97 tbr, 1000k tbn, 1000k tbc
Stream mapping:
  Stream #0:1 -> #0:0 (v210 (native) -> v210 (native))
  Stream #0:0 -> #0:1 (pcm_s16le (native) -> aac (native))
Press [q] to stop, [?] for help
Output #0, mov, to 'devlin5.mov':
  Metadata:
    encoder         : Lavf58.17.100
    Stream #0:0: Video: v210 (v210 / 0x30313276), yuv422p10le(bottom coded first (swapped)), 720x486, q=2-31, 223725 kb/s, 29.97 fps, 30k tbn, 29.97 tbc
    Metadata:
      encoder         : Lavc58.19.104 v210
    Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 7.1, fltp, 469 kb/s
    Metadata:
      encoder         : Lavc58.19.104 aac
[decklink @ 0x7f9f66800000] Unable to find timecode.
    Last message repeated 15 times
[decklink @ 0x7f9f66800000] Unable to find timecode.0:00.70 bitrate=200517.8kbits/s speed= 1.4x    
    Last message repeated 14 times
[decklink @ 0x7f9f66800000] Unable to find timecode.0:01.20 bitrate=211246.0kbits/s speed= 1.2x    
    Last message repeated 14 times
[decklink @ 0x7f9f66800000] Unable to find timecode.0:01.70 bitrate=214431.3kbits/s speed=1.13x    
    Last message repeated 14 times
[decklink @ 0x7f9f66800000] Unable to find timecode.0:02.20 bitrate=217121.0kbits/s speed= 1.1x    
    Last message repeated 14 times
[decklink @ 0x7f9f66800000] Unable to find timecode.0:02.70 bitrate=221142.3kbits/s speed=1.07x    
    Last message repeated 14 times
[decklink @ 0x7f9f66800000] Unable to find timecode.0:03.20 bitrate=221288.2kbits/s speed=1.06x    

So when inputing DF this appears to work while Media Express gets it wrong by writing the timecode with a NDF flag.
However when inputing NDF no timecode is communicated.

I ran this to check if somehow I was called the wrong timecode 

for i in rp188vitc rp188vitc2 rp188ltc rp188any vitc vitc2 serial ; do echo -n "${i}: " ; ./ffprobe -v quiet -timecode_format "$i" -f decklink -draw_bars 0 -audio_input embedded -video_input sdi -format_code ntsc -channels 8 -raw_format yuv422p10 -i "UltraStudio 3D" -select_streams v -show_entries stream_tags=timecode -of default=nw=1:nk=1 ; echo ; done

rp188vitc: 
rp188vitc2: 
rp188ltc: 
rp188any: 
vitc: 
vitc2: 
serial: 

I may try to find another NDF tape to make sure this isn’t a fluke.

> And when I skimmed the movenc timecode handling it doesn’t seem to make any assumptions or changes either.

I’ve replicated it with Matroska which simply moves the timecode into metadata as a string.

> Please keep me posted. Meanwhile I will look into what could be causing all the error chatter.

Thanks!

> Thanks,
> Jon
> 
>> On May 31, 2018, at 7:59 AM, Dave Rice <dave at dericed.com> wrote:
>> 
>> 
>>> On May 31, 2018, at 5:49 AM, Jonathan Morley <jmorley at pixsystem.com> wrote:
>>> 
>>> Please take a look at my latest patches.
>>> 
>>> NOTE: I no longer have the hardware to test this work!
>> 
>> I tested these patches with an Ultrastudio 3D.
>> 
>> I find that in some cases it provides the “Unable to set timecode” warning although it does provide the timecode value. Such as:
>> 
>> ./ffmpeg -timecode_format vitc -f decklink -draw_bars 0 -audio_input embedded -video_input sdi -format_code ntsc -channels 8 -raw_format yuv422p10 -i "UltraStudio 3D" -c:v v210 -c:a aac signs.mov
>> ffmpeg version N-91200-g1616b1be5a Copyright (c) 2000-2018 the FFmpeg developers
>> built with Apple LLVM version 9.0.0 (clang-900.0.38)
>> configuration: --enable-nonfree --enable-decklink --extra-cflags=-I/usr/local/include --extra-ldflags=-L/usr/local/include
>> libavutil      56. 18.102 / 56. 18.102
>> libavcodec     58. 19.104 / 58. 19.104
>> libavformat    58. 17.100 / 58. 17.100
>> libavdevice    58.  4.100 / 58.  4.100
>> libavfilter     7. 24.100 /  7. 24.100
>> libswscale      5.  2.100 /  5.  2.100
>> libswresample   3.  2.100 /  3.  2.100
>> [decklink @ 0x7f8711802600] Found Decklink mode 720 x 486 with rate 29.97(i)
>> [decklink @ 0x7f8711802600] Unable to set timecode
>> Guessed Channel Layout for Input Stream #0.0 : 7.1
>> Input #0, decklink, from 'UltraStudio 3D':
>> Duration: N/A, start: 0.000000, bitrate: 229869 kb/s
>>   Stream #0:0: Audio: pcm_s16le, 48000 Hz, 7.1, s16, 6144 kb/s
>>   Stream #0:1: Video: v210 (V210 / 0x30313256), yuv422p10le(bottom first), 720x486, 223725 kb/s, 29.97 fps, 29.97 tbr, 1000k tbn, 1000k tbc
>>   Metadata:
>>     timecode        : 00:59:53;25
>> Stream mapping:
>> Stream #0:1 -> #0:0 (v210 (native) -> v210 (native))
>> Stream #0:0 -> #0:1 (pcm_s16le (native) -> aac (native))
>> Press [q] to stop, [?] for help
>> Output #0, mov, to 'signs.mov':
>> Metadata:
>>   encoder         : Lavf58.17.100
>>   Stream #0:0: Video: v210 (v210 / 0x30313276), yuv422p10le(bottom coded first (swapped)), 720x486, q=2-31, 223725 kb/s, 0.03 fps, 30k tbn, 29.97 tbc
>>   Metadata:
>>     timecode        : 00:59:53;25
>>     encoder         : Lavc58.19.104 v210
>>   Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 7.1, fltp, 469 kb/s
>>   Metadata:
>>     encoder         : Lavc58.19.104 aac
>> frame=  407 fps= 30 q=-0.0 Lsize=  371576kB time=00:00:13.54 bitrate=224697.2kbits/s speed=1.01x    
>> video:370879kB audio:685kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.003177%
>> [aac @ 0x7f8711805800] Qavg: 30894.625
>> 
>> Another comment is that if I start the recording with ffmpeg before I play through a source I get spammed with timecode errors such as:
>> 
>> ./ffmpeg -timecode_format vitc -f decklink -draw_bars 0 -audio_input embedded -video_input sdi -format_code ntsc -channels 8 -raw_format yuv422p10 -i "UltraStudio 3D" -c:v v210 -c:a aac notplaying.mov
>> ffmpeg version N-91200-g1616b1be5a Copyright (c) 2000-2018 the FFmpeg developers
>> built with Apple LLVM version 9.0.0 (clang-900.0.38)
>> configuration: --enable-nonfree --enable-decklink --extra-cflags=-I/usr/local/include --extra-ldflags=-L/usr/local/include
>> libavutil      56. 18.102 / 56. 18.102
>> libavcodec     58. 19.104 / 58. 19.104
>> libavformat    58. 17.100 / 58. 17.100
>> libavdevice    58.  4.100 / 58.  4.100
>> libavfilter     7. 24.100 /  7. 24.100
>> libswscale      5.  2.100 /  5.  2.100
>> libswresample   3.  2.100 /  3.  2.100
>> [decklink @ 0x7fe313803000] Found Decklink mode 720 x 486 with rate 29.97(i)
>> [decklink @ 0x7fe313803000] Unable to find timecode.
>>   Last message repeated 5 times
>> Guessed Channel Layout for Input Stream #0.0 : 7.1
>> Input #0, decklink, from 'UltraStudio 3D':
>> Duration: N/A, start: 0.000000, bitrate: 229869 kb/s
>>   Stream #0:0: Audio: pcm_s16le, 48000 Hz, 7.1, s16, 6144 kb/s
>>   Stream #0:1: Video: v210 (V210 / 0x30313256), yuv422p10le(bottom first), 720x486, 223725 kb/s, 29.97 fps, 29.97 tbr, 1000k tbn, 1000k tbc
>> Stream mapping:
>> Stream #0:1 -> #0:0 (v210 (native) -> v210 (native))
>> Stream #0:0 -> #0:1 (pcm_s16le (native) -> aac (native))
>> Press [q] to stop, [?] for help
>> Output #0, mov, to 'notplaying.mov':
>> Metadata:
>>   encoder         : Lavf58.17.100
>>   Stream #0:0: Video: v210 (v210 / 0x30313276), yuv422p10le(bottom coded first (swapped)), 720x486, q=2-31, 223725 kb/s, 29.97 fps, 30k tbn, 29.97 tbc
>>   Metadata:
>>     encoder         : Lavc58.19.104 v210
>>   Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 7.1, fltp, 469 kb/s
>>   Metadata:
>>     encoder         : Lavc58.19.104 aac
>> [decklink @ 0x7fe313803000] Unable to find timecode.
>>   Last message repeated 14 times
>> [decklink @ 0x7fe313803000] Unable to find timecode.0:00.66 bitrate=210543.0kbits/s speed=1.33x    
>>   Last message repeated 14 times
>> [decklink @ 0x7fe313803000] Unable to find timecode.0:01.16 bitrate=217281.3kbits/s speed=1.17x    
>>   Last message repeated 14 times
>> [decklink @ 0x7fe313803000] Unable to find timecode.0:01.66 bitrate=218719.7kbits/s speed=1.11x    
>>   Last message repeated 14 times
>> [decklink @ 0x7fe313803000] Unable to find timecode.0:02.16 bitrate=219494.2kbits/s speed=1.08x    
>>   Last message repeated 14 times
>> [decklink @ 0x7fe313803000] Unable to find timecode.0:02.66 bitrate=220763.9kbits/s speed=1.07x    
>>   Last message repeated 14 times
>> [decklink @ 0x7fe313803000] Unable to find timecode.0:03.16 bitrate=220971.1kbits/s speed=1.06x    
>>   Last message repeated 14 times
>> [decklink @ 0x7fe313803000] Unable to find timecode.0:03.67 bitrate=221693.2kbits/s speed=1.05x    
>>   Last message repeated 14 times
>> [decklink @ 0x7fe313803000] Unable to find timecode.0:04.17 bitrate=223247.5kbits/s speed=1.04x  
>> 
>> Until I hit the play button on my source.
>> 
>> I tested the same videotape sources with Media Express and ffmpeg with this patch and the initial timecode values are aligned to the same frames accurately, but with 4 random videotapes I’ve tried, all the Media Express captures are Non-Drop Frame and all the ffmpeg captures are Drop Frame, so one has to be wrong. I’ll try to find a source that can provide a known df and ndf signal to determine which is correct.
>> 
>> Thanks for the update,
>> Dave Rice
>> 
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel at ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel



More information about the ffmpeg-devel mailing list