Řeším problém s dávkovým, dá se říci automatickým střihem, který mám naprogramovaný jako script Avisynthu. Ve zkratce - dochází k sestřihání hodinového H264 videa na cca 5 minutovou verzi složenou z 5 bloků, ořezu videa, přidání vodoznaku a následný export opět do H264. Problém je v tom, že nějaká videa to prostě neotevře a vyhodí to chybu. avs.avs: Unknown error occurred. Dělají se takto tisíce videí, zatím jsem to řešil tak, že videa, která nešla, jsem pomocí Adobe Media Encoder recodoval znovu, a pak to nějak schroupalo, ale takový videí je čím dál více, rád bych toto převáděl rovnou Avisynthem... Mohl by mi někdo poradit, prosím?
1) testuji pro zjednodušení na Avisynth kódu avs.avs:
Kód:
LoadCPlugIn("ffms2.dll")
#zmen si cestu k videu
X = "01.mp4"
A = FFAudioSource(X)
V = FFVideoSource(X)
clipA = AudioDub(V, A)
frate = FrameRate(clipA)
# kolik frame do 20sec
cusek = Floor(20 * frate)
# urizne 20sec videa od frame 1000 asi od 40sec
Trim(clipA, 1000, cusek+1000)
2) .BAT soubor:
Kód:
ffmpeg.exe -y -report -threads 0 -i avs.avs -c:v libx264 -pix_fmt yuv420p -profile:v high -level 4.2 -preset medium -b:v 1500k -b:a 128k vystupnivideo.mp4
3) LOG soubor vypadá poté:
Kód:
ffmpeg started on 2017-03-28 at 17:44:33
Report written to "ffmpeg-20170328-174433.log"
Command line:
ffmpeg.exe -y -report -threads 0 -i avs.avs -c:v libx264 -pix_fmt yuv420p -profile:v high -level 4.1 -preset medium -b:v 1500k -b:a 128k vystupnivideo.mp4
ffmpeg version N-84679-gd65b595 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 6.3.0 (GCC)
configuration: --enable-gpl --enable-version3 --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc --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-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-zlib
libavutil 55. 51.100 / 55. 51.100
libavcodec 57. 86.103 / 57. 86.103
libavformat 57. 67.100 / 57. 67.100
libavdevice 57. 3.101 / 57. 3.101
libavfilter 6. 78.100 / 6. 78.100
libswscale 4. 3.101 / 4. 3.101
libswresample 2. 4.100 / 2. 4.100
libpostproc 54. 2.100 / 54. 2.100
Splitting the commandline.
Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'.
Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
Reading option '-threads' ... matched as AVOption 'threads' with argument '0'.
Reading option '-i' ... matched as input url with argument 'avs.avs'.
Reading option '-c:v' ... matched as option 'c' (codec name) with argument 'libx264'.
Reading option '-pix_fmt' ... matched as option 'pix_fmt' (set pixel format) with argument 'yuv420p'.
Reading option '-profile:v' ... matched as option 'profile' (set profile) with argument 'high'.
Reading option '-level' ... matched as AVOption 'level' with argument '4.1'.
Reading option '-preset' ... matched as AVOption 'preset' with argument 'medium'.
Reading option '-b:v' ... matched as option 'b' (video bitrate (please use -b:v)) with argument '1500k'.
Reading option '-b:a' ... matched as option 'b' (video bitrate (please use -b:v)) with argument '128k'.
Reading option 'vystupnivideo.mp4' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option y (overwrite output files) with argument 1.
Applying option report (generate a report) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input url avs.avs.
Successfully parsed a group of options.
Opening an input file: avs.avs.
[file @ 0000000000703e20] Setting default whitelist 'file,crypto'
[avisynth @ 00000000001e6fc0] Format avisynth probed with size=2048 and score=50
[AVIOContext @ 00000000001e75c0] Statistics: 303 bytes read, 0 seeks
avs.avs: Unknown error occurred
4) MediaInfo vstupního souboru, který nešel převést:
Kód:
Hlavní
Celý název a cesta : H:\_FF\ffmpeg-20170327-d65b595-win64-static\bin\01.mp4
Formát : MPEG-4
Format_Profile : Base Media
CodecID/String : isom (isom)
Velikost souboru : 899 MiB
Duration/String : 43 min 8 s
Celkový BitRate : 2 912 kb/s
Encoded date : UTC 2014-07-28 00:57:33
Tagged date : UTC 2014-07-28 00:57:33
Použitý software : Yamb 2.1.0.0 [http://yamb.unite-video.com]
Video
ID : 1
Formát : AVC
Formát/ : Advanced Video Codec
Format_Profile : High@L4.1
Format_Settings_CABAC/String : Ano
Format_Settings_RefFrames/String : 4 frame
CodecID : avc1
/ : Advanced Video Coding
Duration/String : 43 min 8 s
Bit rate : 2 462 kb/s
BitRate_Maximum/String : 4 831 kb/s
Šířka : 1 280pixely
Výška : 720pixely
Poměr stran : 16:9
Frame rate : 24,000 FPS
Minimum frame rate : 12,000 FPS
Maximum frame rate : 24,000 FPS
ColorSpace : YUV
ChromaSubsampling/String : 4:2:0
BitDepth/String : 8 bits
ScanType/String : Progressive
Bits/(Pixel*Frame) : 0.111
StreamSize/String : 760 MiB (85%)
Enkódoval : x264 core 130 r2273 b3065e6
Nastavení enkoderu : cabac=1 / ref=2 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=6 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=24 / lookahead_threads=4 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=1 / keyint=240 / keyint_min=24 / scenecut=40 / intra_refresh=0 / rc_lookahead=30 / rc=crf / mbtree=1 / crf=21.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / vbv_maxrate=62500 / vbv_bufsize=78125 / crf_max=0.0 / nal_hrd=none / ip_ratio=1.40 / aq=1:1.00
Encoded date : UTC 2014-07-23 19:29:00
Tagged date : UTC 2014-07-28 00:57:36
colour_range : Limited
colour_primaries : BT.709
transfer_characteristics : BT.709
matrix_coefficients : BT.709
Audio #1
ID : 2
Formát : AAC
Formát/ : Advanced Audio Codec
Format_Profile : LC
CodecID : 40
Duration/String : 43 min 8 s
Bit rate : 128 kb/s
BitRate_Maximum/String : 171 kb/s
Kanál(y) : 2 kanály
Channel positions : Front: L R
Sampling rate : 48,0 kHz
Frame rate : 46,875 FPS (1024 spf)
StreamSize/String : 39,4 MiB (4%)
Jazyk : English
Encoded date : UTC 2014-07-28 00:57:35
Tagged date : UTC 2014-07-28 00:57:36
Moc děkuji...