
    W|h|                         S r SSKrSSKrSSKrSSKrSSKrSSKJ	r	  SSK
JrJrJr   " S S5      rSS jr " S S	5      r    SS
 jrg)zGImplements all the functions to read a video or a picture using ffmpeg.    N)FFMPEG_BINARY)convert_to_secondscross_platform_popen_paramsffmpeg_escape_filenamec                   x    \ rS rSrSr        SS jrSS jrSS jrS rS r	\
S	 5       rS
 rSS jrS rSrg)FFMPEG_VideoReader   z/Class for video byte-level reading with ffmpeg.Nc
                    Xl         S U l        [        UUU	UUS9n
U
R                  SS5      U l        U
R                  SS5      U l        [        U
R                  SS5      5      U l        U R                  S;   a#  U R
                  S	   U R
                  S   /U l        U(       ax  S U;   al  S	n[        U5       H  u  pU(       d  M  XR
                  U   -  nM!     [        U R
                  S   U-  5      [        U R
                  S	   U-  5      4U l        OXpl        Xl
        U
R                  S
S5      U l        U
R                  SS5      U l        U
R                  SS5      U l        U
R                  SS5      U l        Xl        XPl        US   S:X  a  SOSU l        Uc#  U R
                  u  pU R"                  U-  U-  S-   nX@l        U R'                  5         g )N)check_duration
fps_sourcedecode_fileprint_infos	video_fps      ?
video_size)   r   video_rotationr   )Z   i  r   video_duration        durationvideo_n_framesvideo_bitratea      d   )filenameprocffmpeg_parse_infosgetfpssizeabsrotation	enumerateintresize_algor   ffmpeg_durationn_framesbitrateinfospixel_formatdepthbufsize
initialize)selfr   r   r   r0   r.   r   target_resolutionr)   r   r-   ratioidxtargetwhs                   X/home/james-whalen/.local/lib/python3.13/site-packages/moviepy/video/io/ffmpeg_reader.py__init__FFMPEG_VideoReader.__init__   s    !	")!##
 99[#.IIlF3	 EII&6:;==I%1tyy|4DI((#,->#?KCv &3 7 $@ !1!56DIIaL5<P8QR	-	&		"2C8$yyS9		"2A6yy!4
(&r*c1Qq
 ?99DAjj1nq(3.G    c                 J   U R                  SS9  U R                  U5      U l        U R                  S:w  a   U R                  SU R                  -  -  S-
  nOSnUS:w  a0  [	        SU5      nSSX-
  -  S	[        U R                  5      SSU-  /nOS	[        U R                  5      /nU R                  S
:X  a6  U R                  R                  S5      nUS:X  a  SS/U-   nOUS:X  a  SS/U-   n[        /U-   SSSSSS[        U R                  5      -  SU R                  SU R                  SSS/-   n[        U R                   ["        R$                  ["        R$                  ["        R&                  S.5      n["        R(                  " U40 UD6U l        U R-                  5       U l        g)z
Opens the file, creates the pipe.

Sets self.pos to the appropriate value (1 if start_time == 0 because
it pre-reads the first frame).
F)delete_lastreadr   r   h㈵>r   z-ssz%.06f-ir   video_codec_namevp9z-c:vz
libvpx-vp9vp8libvpxz	-loglevelerror-f
image2pipez-vfzscale=%d:%dz
-sws_flagsz-pix_fmtz-vcodecrawvideo-r0   stdoutstderrstdinN)closeget_frame_numberposr#   minr   r   r/   r-   r"   r   tupler$   r)   r.   r   r0   spPIPEDEVNULLPopenr    
read_frame	last_read)r2   
start_timeoffseti_arg
codec_namecmdpopen_paramss          r9   r1   FFMPEG_VideoReader.initializeS   s    	

5
)
 ((4 88q=Q\2W<JJ?J'F:./&t}}5& E 1$--@AE ::?(:;JU".6u$*U2 O dii 00  !! 	( 3<<''''	
 HHS1L1	*r<   c                     U R                   u  p#[        U5       H8  nU R                  R                  R	                  U R
                  U-  U-  5        M:     U =R                  U-  sl        g)zReads and throws away n framesN)r$   ranger    rK   readr/   rP   )r2   nr7   r8   is        r9   skip_framesFFMPEG_VideoReader.skip_frames   sO    yyqAII!!$**q.1"45  	Ar<   c           
         U R                   u  pU R                  U-  U-  nU R                  R                  R	                  U5      n[        U5      U:w  a  [        R                  " SU R                  U[        U5      U R                  U R                  SU R                  -  U R                  -  U R                  4-  [        5        [        U S5      (       d  [        SU R                   S35      eU R                   nO][        ["        S5      (       a  ["        R$                  " USS9nO["        R&                  " USS9nX![        U5      X-  -  4Ul        XPl        U =R                  S	-  sl	        U$ )
z
Reads the next frame from the file.
Note that upon (re)initialization, the first frame will already have been read
and stored in ``self.last_read``.
zIn file %s, %d bytes wanted but %d bytes read at frame index %d (out of a total %d frames), at time %.02f/%.02f sec. Using the last valid frame instead.r   rX   z<MoviePy error: failed to read the first frame of video file z. That might mean that the file is corrupted. That may also mean that you are using a deprecated version of FFMPEG. On Ubuntu/Debian for instance the version in the repos is deprecated. Please update to a recent version from the website.
frombufferuint8)dtyper   )r$   r/   r    rK   rb   lenwarningswarnr   rP   r+   r#   r   UserWarninghasattrIOErrorrX   nprh   
fromstringshape)r2   r7   r8   nbytessresults         r9   rW   FFMPEG_VideoReader.read_frame   sC    yya!#II!!&)q6VMM;
 MMFHHMM$((NTXX-MM " 4--&&*mm_ 5NN	 	 ^^F r<((q8q8#a&QU"34FL#N 	Ar<   c                    U R                  U5      S-   nU R                  (       d(  [        S5        U R                  U5        U R                  $ X R
                  :X  a  U R                  $ X R
                  :  d  X R
                  S-   :  a  U R                  U5        U R                  $ U R                  X R
                  -
  S-
  5        U R                  5       nU$ )a  Read a file video frame at time t.

Note for coders: getting an arbitrary frame in the video with
ffmpeg can be painfully slow if some decoding has to be done.
This function tries to avoid fetching arbitrary frames
whenever possible, by moving between adjacent frames.
r   zProc not detectedr   )rO   r    printr1   rX   rP   re   rW   )r2   trP   rv   s       r9   	get_frameFFMPEG_VideoReader.get_frame   s     ##A&* yy%&OOA>>!((?>>!HHn#3"6OOA>>! S88^a/0__&FMr<   c                     U R                   $ )zGAlias of `self.last_read` for backwards compatibility with MoviePy 1.x.)rX   r2   s    r9   lastreadFFMPEG_VideoReader.lastread  s     ~~r<   c                 8    [        U R                  U-  S-   5      $ )z6Helper method to return the frame number at time ``t``r?   )r(   r#   )r2   rz   s     r9   rO   #FFMPEG_VideoReader.get_frame_number  s     488a<')**r<   c                    U R                   (       a  U R                   R                  5       c|  U R                   R                  5         U R                   R                  R	                  5         U R                   R
                  R	                  5         U R                   R                  5         SU l         U(       a  [        U S5      (       a  U ?ggg)z<Closes the reader terminating the process, if is still open.NrX   )	r    poll	terminaterK   rN   rL   waitro   rX   )r2   r>   s     r9   rN   FFMPEG_VideoReader.close  s    99yy~~'		##%		  &&(		  &&(		 DIwt[99  :?r<   c                 $    U R                  5         g N)rN   r~   s    r9   __del__FFMPEG_VideoReader.__del__!  s    

r<   )r,   r0   r/   r   r*   r   r#   r-   rX   r+   r.   rP   r    r)   r&   r$   )TFNrgb24TNbicubicr#   )r   )r   )T)__name__
__module____qualname____firstlineno____doc__r:   r1   re   rW   r{   propertyr   rO   rN   r   __static_attributes__ r<   r9   r   r      s_    9
 <|T+l6p<  +
r<   r   c                 X    U(       d  U(       a  SOSn[        XSS9nUR                  nAU$ )a  Read an image file (PNG, BMP, JPEG...).

Wraps FFMPEG_Videoreader to read just one image.
Returns an ImageClip.

This function is not meant to be used directly in MoviePy.
Use ImageClip instead to make clips out of image files.

Parameters
----------

filename
  Name of the image file. Can be of any format supported by ffmpeg.

with_mask
  If the image has a transparency layer, ``with_mask=true`` will save
  this layer as the mask of the returned ImageClip

pixel_format
  Optional: Pixel format for the image to read. If is not specified
  'rgb24' will be used as the default format unless ``with_mask`` is set
  as ``True``, then 'rgba' will be used.

rgbar   F)r.   r   )r   rX   )r   	with_maskr.   readerims        r9   ffmpeg_read_imager   %  s4    2 !*vEF 
		BIr<   c                   d    \ rS rSrSr   SS jrS rS rS rS r	S r
S	 rS
 rS rS rS rSrg)FFmpegInfosParseriH  a  Finite state ffmpeg `-i` command option file information parser.
Is designed to parse the output fast, in one loop. Iterates line by
line of the `ffmpeg -i <filename> [-f null -]` command output changing
the internal state of the parser.

Parameters
----------

filename
  Name of the file parsed, only used to raise accurate error messages.

infos
  Information returned by FFmpeg.

fps_source
  Indicates what source data will be preferably used to retrieve fps data.

check_duration
  Enable or disable the parsing of the duration of the file. Useful to
  skip the duration check, for example, for images.

decode_file
  Indicates if the whole file has been decoded. The duration parsing strategy
  will differ depending on this argument.
c                 t    Xl         X l        X@l        X0l        U(       a  SOSU l        U R                  5         g )Ntime=
Duration: )r-   r   r   r   duration_tag_separator_reset_state)r2   r-   r   r   r   r   s         r9   r:   FFmpegInfosParser.__init__c  s1     
 ,$1<g,#r<   c                     SU l         SU l        0 U l        S/ 0U l        SU l        SU l        SS0 / S.U l        SU l        g)zpReinitializes the state of the parser. Used internally at
initialization and at the end of the parsing process.
FstreamsN)video_foundaudio_foundmetadatainputs)_inside_file_metadata_inside_output_default_streams_current_input_file_current_stream_current_chapterrv   _last_metadata_field_addedr~   s    r9   r   FFmpegInfosParser._reset_states  s_     &+" $ !# %.r? # $ ! 	
 +/'r<   c                     / nU R                   R                  5       SS  GH  nU R                  S:X  a7  U R                  (       a&  SU;   a   U R	                  U5      U R
                  S'   MK  U R                  (       d	  US   S:w  a.  U R                  S:X  a  U R                  (       d	  SU l        M  M  M  U R                  (       d  UR                  S5      (       a	  SU l        M  UR                  S	5      (       a  S
U l        U R                  (       a.  U R                  S:X  a  U R	                  U5      U R
                  S'   [        R                  " SU5      nU(       a  [        UR                  S5      5      OSU R
                  S'   [        R                  " SU5      nU(       a  [        UR                  S5      5      OSU R
                  S'   GM  U R                  (       aX  U R                  U5      u  pVUS:X  a%  U R                  nU R
                  S   U   S-   U-   nOXPl        X`R
                  S   U'   GM  UR!                  5       R                  S5      (       Ga  U R"                  (       a(  U R$                  S   R'                  U R"                  5        [        R                  " SUR!                  5       5      nUR)                  5       u  nn	n
n[        U5      n[        U	5      n	UR+                  5       nU
S:X  a  Sn
UU	UU
XR,                  ;  =(       a    UR/                  S5      S.U l        U R"                  S   (       a  U R"                  U R,                  U'   U R0                  (       a$  X   R'                  U R0                  5        SU l        SU R$                  ;  a  XR$                  S'   OhU R$                  S   U:w  aU  [3        U5      US-   :  a  UU   U R$                  S'   U R
                  S   R'                  U R$                  5        SU0U l         U R5                  X5      nU R"                  R7                  U5        GM)  UR                  S5      (       a  GMB  U R"                  (       a  SU R"                  ;  a  0 U R"                  S'   U R                  U5      u  pVU R"                  S   S :X  a<  U RC                  XV5      u  pVUS!:X  a  X`R
                  S"'   OUS#:X  a  X`R
                  S"'   US:X  a%  U R                  nU R"                  S   U   S-   U-   nOXPl        X`R"                  S   U'   GM  UR                  S$5      (       a  U R0                  (       aZ  [3        U5      U R0                  S   S-   :  a  UR'                  / 5        XR0                  S      R'                  U R0                  5        [        R                  " S%U5      nUR)                  5       u  nnnn[        U5      [        U5      [        U5      [        U5      S&.U l        GM  U R0                  (       d  GM  SU R0                  ;  a  0 U R0                  S'   U R                  U5      u  pVUS:X  a%  U R                  nU R0                  S   U   S-   U-   nOXPl        X`R0                  S   U'   GM     U R$                  (       a  U R$                  S   R'                  U R"                  5        SU R$                  ;   a>  [3        U5      U R$                  S   S-   :X  a  UU R$                  S      U R$                  S'   U R
                  S   R'                  U R$                  5        U R$                  S    H/  nUS   U R,                  ;  d  M  UU R,                  US   '   SUS'   M1     U R,                  RE                  5        GH  u  pUS   U R
                  S'U S(3'   US)   U R
                  S'U S*3'   US+:X  a5  SU R
                  S,'   US-   U R
                  S.'   US   U R
                  S/'   Mm  US :X  d  Mu  SU R
                  S0'   URG                  S1S5      U R
                  S2'   URG                  SS5      U R
                  S3'   US-   U R
                  S4'   URG                  S5S5      U R
                  S6'   URG                  S7S5      U R
                  S8'   GM     U R
                  S0   (       ap  U R                  (       a_  U R
                  S   U R
                  S9'   [        U R
                  S   U R
                  RG                  S4S5      -  5      U R
                  S:'   OSU R
                  S:'   S;U R
                  S9'   U R
                  S,   (       a  U R
                  RG                  S/5      (       dx  SU R
                  S/'   U R
                  S    HV  nUS    H8  nUS   S+:X  d  M  URG                  S5      (       d  M&  US   U R
                  S/'     O   U R
                  S/   c  MV    O   U R
                  nU RI                  5         U$ ! [8         a?  n[:        R<                  " [?        U5       SU R                    3[@        5         SnAG
MX  SnAff = f)<zParses the information returned by FFmpeg in stderr executing their binary
for a file with ``-i`` option and returns a dictionary with all data needed
by MoviePy.
r   Nr   r   r    Tz  Metadata:z  Duration:Fr   zbitrate: (\d+) k(i?)b/sr,   zstart: (\d+\.?\d+)start r   
zStream r   z6^Stream\s#(\d+):(\d+)(?:\[\w+\])?\(?(\w+)?\)?:\s(\w+):undz	(default))input_numberstream_numberstream_typelanguagedefaultr   r   chaptersr   z
ffmpeg output:

z    Metadata:r   videorotater   displaymatrixz    Chapterz?^    Chapter #(\d+):(\d+): start (\d+\.?\d+?), end (\d+\.?\d+?))r   chapter_numberr   enddefault__input_numberr   _stream_numberaudior   r#   	audio_fpsaudio_bitrater   r$   r   r   r   r\   rA   profilevideo_profiler   r   r   )%r-   
splitlinesr   r   parse_durationrv   r   r   
startswithresearchr(   groupfloatparse_metadata_field_valuer   lstripr   r   appendgroupslowerr   endswithr   rk   parse_data_by_stream_typeupdateNotImplementedErrorrl   rm   strrn   video_metadata_type_castingitemsr"   r   )r2   input_chapterslinebitrate_matchstart_matchfieldvaluemain_info_matchr   r   r   r   stream_type_lowerstream_dataexcchapter_data_matchr   r   r   streamstreams_inputrv   s                         r9   parseFFmpegInfosParser.parse  sz	    JJ))+AB/D++w6''tO +/*=*=d*CJ'$$Q3..'9$BUBU*.D' CV9 //DOOM4R4R-1*//-2*&&4+F+F,+V.2.A.A$.GDKK
+ !#		*Dd K3@C++A./d I&
 !ii(=tD3>E+++A./D G$ ++#>>tD B; ;;E KK
3E:TAEIE6;316J'.)))44'',,Y7>>t?S?ST #%))MKKM# $**, !"<0 #M 2$/$5$5$7!u$#H %1%2#4 ( 19N9N N  3k2($ ''	2?C?S?SD))*;< (("0778M8MN,0D)!)A)AA?K,,^<--n=M >*lQ.>>?M(@00<
 KK)001I1IJ0>/MD,="&"@"@"SK ((//<11%%T%9%9979D((4#>>tD''6'A#'#C#CE#QLE(8=$45/18=$45 B; ;;E 00<UCdJURE6;3:?$$Z07//((>*T-B-B>-RUV-VV&--b1"#8#8#HIPP--
 &(YYV&" <N;T;T;V8neS %($5&).&9"5\ :	)% &&&T%:%::8:D))*5#>>tD B; ;;E 11*=eDtKeSE6;3;@%%j1%8[ 0` ##$$Y/66t7K7KL $":"::'4+C+CN+SVW+WW7E,,^<8((4 KK!(()A)AB ..y9Fm$D,A,AA?E%%f]&;<$(y! : /3.C.C.I.I.K*GRHDKK(#4"5]CD ITIDKK(#4"5^DE !G+-1M*+6u+=K(/:9/EO,"g--1M*,7OOFD,IL)/:y$/OO,+6u+=K(2=//,PT2U.//:y$/OO,% /L* ;;}%$*=*=,0KK
,CDKK(),/J'$++//+q*II-DKK() -.DKK(),/DKK()
 ;;}%dkkooo.N.N+/DKK(!%X!6+I6Fm,7FJJy<Q<Q7=i7HO4 7
 ;;/; "7  	W + MMs8*$8E{ s   h44
i=>3i88i=c                      U R                   U R                  S S.U   " U5      $ ! [         a    [        U S35      ef = f)z1Parses data from "Stream ... {stream_type}" line.c                     0 $ r   r   )_lines    r9   <lambda>=FFmpegInfosParser.parse_data_by_stream_type.<locals>.<lambda>  s    br<   )AudioVideoDataz? stream parsing is not supported by moviepy and will be ignored)parse_audio_stream_dataparse_video_stream_dataKeyErrorr   )r2   r   r   s      r9   r   +FFmpegInfosParser.parse_data_by_stream_type  sg    
	5555( 	  	! !
  	%-  # # 	s   #& ?c                     0 n [        [        R                  " SU5      R                  S5      5      US'   [        R                  " SU5      nU(       a  [        UR                  S5      5      OSUS'   U$ ! [        [
        4 a    SUS'    NVf = f)z)Parses data from "Stream ... Audio" line.z	 (\d+) Hzr   r#   unknown(\d+) k(i?)b/sNr,   )r(   r   r   r   AttributeError
ValueError)r2   r   r   match_audio_bitrates       r9   r   )FFmpegInfosParser.parse_audio_stream_data  s    	+!$RYY|T%B%H%H%K!LK
 !ii(94@1DC#))!,-$ 	I  
+ 	+ "+K	+s   2A5 5BBc                    0 n [         R                  " SU5      nU(       a-  UR                  5        Vs/ s H  n[        U5      PM     snUS'   [         R                  " SU5      nU(       a  [        UR                  S5      5      OSUS'   U R                  S	:X  a   U R                  U5      nOKU R                  S
:X  a   U R                  U5      nO([        SU R                  < SU R                  < S35      eSnS H$  nXh:w  d  M
  [        XhU-  -
  5      S:  d  M   X-  nM&     XbS	'   [         R                  " SUR                  5       5      n	U	b  U	R                  5       u  pXS'   XS'   U$ s  snf ! [         a(    [        SU R                  < SU R                  < 35      ef = f! [        [        4 a    U R                  U5      n Nf = f! [        [        4 a    U R                  U5      n Nf = f)z)Parses data from "Stream ... Video" line.z (\d+)x(\d+)[,\s]r$   z8MoviePy error: failed to read video dimensions in file 'z/'.
Here are the file infos returned byffmpeg:

r   r   Nr,   r#   tbrzfps source 'z#' not supported parsing the video ''g	.l?)            2   g{Gz?zVideo:\s(\w+)?\s?(\([^)]+\))?r\   r   )r   r   r   r(   	Exceptionrp   r   r-   r   r   	parse_fpsr   r   	parse_tbrr%   r   )r2   r   r   match_video_sizenummatch_bitrater#   coefxr   r\   r   s               r9   r   )FFmpegInfosParser.parse_video_stream_data  s   	!yy)=tD;K;R;R;T&U;TCs3x;T&UF# 		"3T:@M]%8%8%;!<SWI ??e#+nnT* __%+nnT* ??DMM3  %Ac#D.1D8h & !E )),KKM
 &$3$:$:$<!Z(2%%,	"q 'V 	 ==$**. 	0 #J/ +nnT*+
 #J/ +nnT*+s@   0E3 E.	E3 F(  G .E3 32F%(!GG!G32G3c                 `    [        [        R                  " SU5      R                  S5      5      $ )zEParses number of FPS from a line of the ``ffmpeg -i`` command output.z (\d+.?\d*) fpsr   r   r   r   r   )r2   r   s     r9   r	  FFmpegInfosParser.parse_fps  s$    RYY148>>qABBr<   c                     [         R                  " SU5      R                  S5      nUS   S:X  a  [        USS 5      S-  nU$ [        U5      nU$ )zEParses number of TBS from a line of the ``ffmpeg -i`` command output.z (\d+.?\d*k?) tbrr   r   kNi  )r   r   r   r   )r2   r   s_tbrr  s       r9   r
  FFmpegInfosParser.parse_tbr  sX    		.5;;A> 9cr
#d*C 
 ,C
r<   c                     UR                  U R                  5      S   n[        R                  " SU5      n[	        UR                  S5      5      $ ! [         a(    [        SU R                  < SU R                  < 35      ef = f)zMParse the duration from the line that outputs the duration of
the container.
r   z-([0-9][0-9]:[0-9][0-9]:[0-9][0-9].[0-9][0-9])r   z4MoviePy error: failed to read the duration of file 'z0'.
Here are the file infos returned by ffmpeg:

)
splitr   r   r   r   r   r  rp   r   r-   )r2   r   time_raw_stringmatch_durations       r9   r    FFmpegInfosParser.parse_duration  s|    	"jj)D)DEbIOYY@N &n&:&:1&=>> 	
 ==$**	. 	s   AA 2Bc                     UR                  SS5      n[        U5      S:X  a&  Uu  p4UR                  S5      UR                  S5      4$ g)zZReturns a tuple with a metadata field-value pair given a ffmpeg `-i`
command output line.
:r      r   )r   r   )r  rk   strip)r2   r   info	raw_field	raw_values        r9   r   ,FFmpegInfosParser.parse_metadata_field_value  sG     zz#q!t9>#' IOOC()//#*>??r<   c                     US:X  a  U[        U5      4$ US:X  a<  [        R                  " SU5      nU(       a  U[        UR                  5       5      S-  4$ X4$ )zFCast needed video metadata fields to other types than the default str.r   r   z[-+]?\d+(\.\d+)?r   r  )r2   r   r   matchs       r9   r   -FFmpegInfosParser.video_metadata_type_casting&  sZ    H5<((o%II159E uU[[]3b899~r<   )r   r   r   r   r   r   r   r   r   r   r   r-   rv   N)r#   TF)r   r   r   r   r   r:   r   r   r   r   r   r	  r
  r   r   r   r   r   r<   r9   r   r   H  sO    <  #/J||@DC	(r<   r   c                    [         SS[        U 5      /nU(       a  UR                  / SQ5        [        S[        R
                  [        R
                  [        R                  S.5      n[        R                  " U40 UD6nUR                  5       u  pU	R                  SSS9n
UR                  5         AU(       a  [        U
5         [        U
U UUUS	9R                  5       $ ! [         az  n[        R                   R#                  U 5      (       a  [%        S
U  S35      e[        R                   R'                  U 5      (       d  [)        S
U  S35      e[+        SU
 35      UeSnAff = f)aT  Get the information of a file using ffmpeg.

Returns a dictionary with next fields:

- ``"duration"``
- ``"metadata"``
- ``"inputs"``
- ``"video_found"``
- ``"video_fps"``
- ``"video_n_frames"``
- ``"video_duration"``
- ``"video_bitrate"``
- ``"video_metadata"``
- ``"audio_found"``
- ``"audio_fps"``
- ``"audio_bitrate"``
- ``"audio_metadata"``
- ``"video_codec_name"``
- ``"video_profile"``

Note that "video_duration" is slightly smaller than "duration" to avoid
fetching the incomplete frames at the end, which raises an error.

Parameters
----------

filename
  Name of the file parsed, only used to raise accurate error messages.

infos
  Information returned by FFmpeg.

fps_source
  Indicates what source data will be preferably used to retrieve fps data.

check_duration
  Enable or disable the parsing of the duration of the file. Useful to
  skip the duration check, for example, for images.

decode_file
  Indicates if the whole file must be read to retrieve their duration.
  This is needed for some files in order to get the correct duration (see
  https://github.com/Zulko/moviepy/pull/1222).
z-hide_bannerr@   )rF   nullrI   i rJ   utf8ignore)errors)r   r   r   r  z' is a directoryz' not foundz+Error passing `ffmpeg -i` command output:

N)r   r   extendr   rS   rT   rU   rV   communicatedecoder   ry   r   r   r  ospathisdirIsADirectoryErrorexistsFileNotFoundErrorrp   )r   r   r   r   r   r]   r^   r    outputrE   r-   r   s               r9   r!   r!   5  sB   h .$0Fx0P
QC

&'.ggggZZ		
L 88C(<(D&&(OVLLL1ENNeX !)#
 %'	  X77==""#az1A$BCC))#az$=>>EeWMNTWWXs   C   
E$*A5EE$)TN)Tr#   FF)r   r0  r   
subprocessrS   rl   numpyrq   moviepy.configr   moviepy.toolsr   r   r   r   r   r   r!   r   r<   r9   <module>r;     sY    M 	 	    ( P Pf Fj j^ YXr<   