Я использую фильтр временного кода drawtext в ffmpeg с отличными результатами, когда исходное видео составляет 25 кадров в секунду, но у меня есть несколько несжатых AVI с низкой частотой кадров, в основном 6. Когда я использую r = 6, внутри цепочки фильтров это приводит к ошибке «неподдерживаемая частота кадров». У кого-нибудь есть предложения по правильному созданию тайм-кода?
ffmpeg -f m4v -i "H:\\Temp\\Analysis\\QuickBackup_Exe\\Analysis\\Test\\010-1927.dat" -filter_complex "drawtext=fontfile=arialbd.ttf: timecode='19\\:27\\:00\\:00':r=25:\\x=(w-tw)/2:y=h-(2*lh):fontcolor=white: fontsize=30:box=0:boxcolor=white:borderw=1" -vsync drop -r 6 -c:v rawvideo -f avi "H:\\Temp\\Analysis\\QuickBackup_Exe\\Analysis\\Test\\010-1927.avi" -report
Это работает, но скорость неверна. Если я исправлю ставку до 6, как и должно быть, я получу эту ошибку ..
ffmpeg started on 2014-09-22 at 21:25:08
Report written to "ffmpeg-20140922-212508.log"
Command line:
ffmpeg -f m4v -i "H:\\Temp\\Analysis\\QuickBackup_Exe\\Analysis\\Test\\010-1927.dat" -filter_complex "drawtext=fontfile=arialbd.ttf: timecode='19\\:27\\:00\\:00':r=6:\\x=(w-tw)/2:y=h-(2*lh):fontcolor=white: fontsize=30:box=0:boxcolor=white:borderw=1" -vsync drop -r 6 -c:v rawvideo -f avi "H:\\\\Temp\\Analysis\\QuickBackup_Exe\\Analysis\\Test\\010-1927_6.avi" -report
ffmpeg version N-66289-gb76d613 Copyright (c) 2000-2014 the FFmpeg developers
built on Sep 15 2014 22:11:04 with gcc 4.8.3 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-decklink --enable-zlib
libavutil 54. 7.100 / 54. 7.100
libavcodec 56. 1.100 / 56. 1.100
libavformat 56. 4.101 / 56. 4.101
libavdevice 56. 0.100 / 56. 0.100
libavfilter 5. 1.100 / 5. 1.100
libswscale 3. 0.100 / 3. 0.100
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 0.100 / 53. 0.100
Splitting the commandline.
Reading option '-f' ... matched as option 'f' (force format) with argument 'm4v'.
Reading option '-i' ... matched as input file with argument 'H:\Temp\Analysis\QuickBackup_Exe\Analysis\Test\010-1927.dat'.
Reading option '-filter_complex' ... matched as option 'filter_complex' (create a complex filtergraph) with argument 'drawtext=fontfile=arialbd.ttf: timecode='19\:27\:00\:00':r=6:\x=(w-tw)/2:y=h-(2*lh):fontcolor=white: fontsize=30:box=0:boxcolor=white:borderw=1'.
Reading option '-vsync' ... matched as option 'vsync' (video sync method) with argument 'drop'.
Reading option '-r' ... matched as option 'r' (set frame rate (Hz value, fraction or abbreviation)) with argument '6'.
Reading option '-c:v' ... matched as option 'c' (codec name) with argument 'rawvideo'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'avi'.
Reading option 'H:\\Temp\Analysis\QuickBackup_Exe\Analysis\Test\010-1927_6.avi' ... matched as output file.
Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option filter_complex (create a complex filtergraph) with argument drawtext=fontfile=arialbd.ttf: timecode='19\:27\:00\:00':r=6:\x=(w-tw)/2:y=h-(2*lh):fontcolor=white: fontsize=30:box=0:boxcolor=white:borderw=1.
Applying option vsync (video sync method) with argument drop.
Applying option report (generate a report) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input file H:\Temp\Analysis\QuickBackup_Exe\Analysis\Test\010-1927.dat.
Applying option f (force format) with argument m4v.
Successfully parsed a group of options.
Opening an input file: H:\Temp\Analysis\QuickBackup_Exe\Analysis\Test\010-1927.dat.
[m4v @ 0000000002ad92c0] Before avformat_find_stream_info() pos: 0 bytes read:32768 seeks:0
[m4v @ 0000000002ad92c0] All info found
[m4v @ 0000000002ad92c0] After avformat_find_stream_info() pos: 30720 bytes read:32768 seeks:0 frames:1
Input #0, m4v, from 'H:\Temp\Analysis\QuickBackup_Exe\Analysis\Test\010-1927.dat':
Duration: N/A, start: 0.833333, bitrate: N/A
Stream #0:0, 1, 1/1200000: Video: mpeg4, yuv420p, 352x288 [SAR 1:1 DAR 11:9], 30 tbr, 1200k tbn, 30 tbc
Successfully opened the file.
Parsing a group of options: output file H:\\Temp\Analysis\QuickBackup_Exe\Analysis\Test\010-1927_6.avi.
Applying option r (set frame rate (Hz value, fraction or abbreviation)) with argument 6.
Applying option c:v (codec name) with argument rawvideo.
Applying option f (force format) with argument avi.
Successfully parsed a group of options.
Opening an output file: H:\\Temp\Analysis\QuickBackup_Exe\Analysis\Test\010-1927_6.avi.
detected 4 logical cores
[Parsed_drawtext_0 @ 000000000026fec0] Setting 'fontfile' to value 'arialbd.ttf'
[Parsed_drawtext_0 @ 000000000026fec0] Setting 'timecode' to value '19:27:00:00'
[Parsed_drawtext_0 @ 000000000026fec0] Setting 'r' to value '6'
[Parsed_drawtext_0 @ 000000000026fec0] Setting 'x' to value '(w-tw)/2'
[Parsed_drawtext_0 @ 000000000026fec0] Setting 'y' to value 'h-(2*lh)'
[Parsed_drawtext_0 @ 000000000026fec0] Setting 'fontcolor' to value 'white'
[Parsed_drawtext_0 @ 000000000026fec0] Setting 'fontsize' to value '30'
[Parsed_drawtext_0 @ 000000000026fec0] Setting 'box' to value '0'
[Parsed_drawtext_0 @ 000000000026fec0] Setting 'boxcolor' to value 'white'
[Parsed_drawtext_0 @ 000000000026fec0] Setting 'borderw' to value '1'
[Parsed_drawtext_0 @ 000000000026fec0] Timecode frame rate 6/1 not supported
[AVFilterGraph @ 000000000026ed40] Error initializing filter 'drawtext' with args 'fontfile=arialbd.ttf: timecode=19\:27\:00\:00:r=6:x=(w-tw)/2:y=h-(2*lh):fontcolor=white: fontsize=30:box=0:boxcolor=white:borderw=1'
Error configuring filters.
[AVIOContext @ 0000000002ac0fe0] Statistics: 32768 bytes read, 0 seeks