ó
    Ÿ“,j('  ã                  ó  • % S SK Jr  S SKrS SKrS SKrS SKrS SKJrJrJ	r	J
r
   S SKJr  S\S'   \r " S S5      r " S	 S
\5      r " S S\5      r " S S\5      r S     SS jjrSSS jjrSS jrg! \ a    \R                  r NYf = f)é    )ÚannotationsN)ÚIOÚAnyÚMappingÚSequence)ÚPopenztype[subprocess.Popen | Popen]Úpopenc                  óv   • \ rS rSrSr    S         S	S jjrS
S jr    S           SS jjrSrg)ÚFFmpegé   z`Wrapper for various `FFmpeg <https://www.ffmpeg.org/>`_ related applications (ffmpeg,
ffprobe).
Nc                ó4  • Xl         U/U l        U =R                  [        USS9-  sl        Ub  U =R                  [        USS9-  sl        Ub  U =R                  [        U5      -  sl        [        R
                  " U R                  5      U l        SU l        g)a’  Initialize FFmpeg command line wrapper.

Compiles FFmpeg command line from passed arguments (executable path, options, inputs and
outputs). ``inputs`` and ``outputs`` are dictionares containing inputs/outputs as keys and
their respective options as values. One dictionary value (set of options) must be either a
single space separated string, or a list or strings without spaces (i.e. each part of the
option is a separate item of the list, the result of calling ``split()`` on the options
string). If the value is a list, it cannot be mixed, i.e. cannot contain items with spaces.
An exception are complex FFmpeg command lines that contain quotes: the quoted part must be
one string, even if it contains spaces (see *Examples* for more info).
For more info about FFmpeg command line format see `here
<https://ffmpeg.org/ffmpeg.html#Synopsis>`_.

:param str executable: path to ffmpeg executable; by default the ``ffmpeg`` command will be
    searched for in the ``PATH``, but can be overridden with an absolute path to ``ffmpeg``
    executable
:param iterable global_options: global options passed to ``ffmpeg`` executable (e.g.
    ``-y``, ``-v`` etc.); can be specified either as a list/tuple/set of strings, or one
    space-separated string; by default no global options are passed
:param dict inputs: a dictionary specifying one or more input arguments as keys with their
    corresponding options (either as a list of strings or a single space separated string) as
    values
:param dict outputs: a dictionary specifying one or more output arguments as keys with their
    corresponding options (either as a list of strings or a single space separated string) as
    values
T)Úsplit_mixedN)Úadd_minus_i_option)Ú
executableÚ_cmdÚ_normalize_optionsÚ_merge_args_optsÚ
subprocessÚlist2cmdlineÚcmdÚprocess)Úselfr   Úglobal_optionsÚinputsÚoutputss        Ú™C:\Users\johnn\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\ffmpy/ffmpy.pyÚ__init__ÚFFmpeg.__init__   s|   € ðB %ŒØ�LˆŒ	Ø�	Š	Ô'¨ÀDÑIÑI�	àÑØ�IŠIÔ)¨&ÀTÑJÑJ�IàÑØ�IŠIÔ)¨'Ó2Ñ2�Iä×*Ò*¨4¯9©9Ó5ˆŒØ8<ˆ�ó    c                óT   • SU R                   R                  < SU R                  < S3$ )NÚ<Ú Ú>)Ú	__class__Ú__name__r   )r   s    r   Ú__repr__ÚFFmpeg.__repr__F   s&   € Ø�4—>‘>×*Ñ*Ñ-¨Q¨t¯x©x©l¸!Ð<Ð<r   c                ó¸  •  [        U R                  4[        R                  X#US.UD6U l        U R                  R                  US9u  pxU R                  R                  S:w  a+  [        U R                  U R                  R                  Xx5      eXx4$ ! [
         a=  nUR                  [        R                  :X  a  [        SU R                   S35      ee SnAff = f)aÚ  Execute FFmpeg command line.

``input_data`` can contain input for FFmpeg in case ``pipe`` protocol is used for input.
``stdout`` and ``stderr`` specify where to redirect the ``stdout`` and ``stderr`` of the
process. By default no redirection is done, which means all output goes to running shell
(this mode should normally only be used for debugging purposes). If FFmpeg ``pipe`` protocol
is used for output, ``stdout`` must be redirected to a pipe by passing `subprocess.PIPE` as
``stdout`` argument. You can pass custom environment to ffmpeg process with ``env``.

Returns a 2-tuple containing ``stdout`` and ``stderr`` of the process. If there was no
redirection or if the output was redirected to e.g. `os.devnull`, the value returned will
be a tuple of two `None` values, otherwise it will contain the actual ``stdout`` and
``stderr`` data returned by ffmpeg process.

More info about ``pipe`` protocol `here <https://ffmpeg.org/ffmpeg-protocols.html#pipe>`_.

:param str input_data: input data for FFmpeg to deal with (audio, video etc.) as bytes (e.g.
    the result of reading a file in binary mode)
:param stdout: redirect FFmpeg ``stdout`` there (default is `None` which means no
    redirection)
:param stderr: redirect FFmpeg ``stderr`` there (default is `None` which means no
    redirection)
:param env: custom environment for ffmpeg process
:param kwargs: any other keyword arguments to be forwarded to `subprocess.Popen
    <https://docs.python.org/3/library/subprocess.html#subprocess.Popen>`_
:return: a 2-tuple containing ``stdout`` and ``stderr`` of the process
:rtype: tuple
:raise: `FFRuntimeError` in case FFmpeg command exits with a non-zero code;
    `FFExecutableNotFoundError` in case the executable path passed was not valid
)ÚstdinÚstdoutÚstderrÚenvzExecutable 'z' not foundN)Úinputr   )r	   r   r   ÚPIPEr   ÚOSErrorÚerrnoÚENOENTÚFFExecutableNotFoundErrorr   ÚcommunicateÚ
returncodeÚFFRuntimeErrorr   )	r   Ú
input_datar*   r+   r,   ÚkwargsÚeÚo_stdoutÚo_stderrs	            r   ÚrunÚ
FFmpeg.runI   sÆ   € ðL	Ü Ø—	‘	ðÜ!+§¡¸ÐTWñØ[añˆDŒLð "Ÿ\™\×5Ñ5¸JÐ5ÐGÑˆØ�<‰<×"Ñ" aÓ'Ü  §¡¨4¯<©<×+BÑ+BÀHÓWÐWàÐ!Ð!øô ó 	Ø�w‰wœ%Ÿ,™,Ó&Ü/°,¸t¿¹Ð>OÈ{Ð0[Ó\Ð\àûð		ús   ‚-B Â
CÂ8CÃC)r   r   r   r   )ÚffmpegNNN)
r   Ústrr   úSequence[str] | str | Noner   ú/Mapping[str, Sequence[str] | str | None] | Noner   r@   ÚreturnÚNone)rA   r>   )NNNN)r6   zbytes | Noner*   úIO | int | Noner+   rC   r,   zMapping[str, str] | Noner7   r   rA   z!tuple[bytes | None, bytes | None])	r%   Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r&   r;   Ú__static_attributes__© r   r   r   r      s¤   † ñð #Ø59ØBFØCGð,=àð,=ð 3ð,=ð @ð	,=ð
 Að,=ð 
õ,=ô\=ð
 $(Ø"&Ø"&Ø(,ð4"à ð4"ð  ð4"ð  ð	4"ð
 &ð4"ð ð4"ð 
+÷4"ð 4"r   r   c                  óH   ^ • \ rS rSrSr   S       SU 4S jjjrSrU =r$ )ÚFFprobeé€   z=Wrapper for `ffprobe <https://www.ffmpeg.org/ffprobe.html>`_.c                ó"   >• [         TU ]  XUS9  g)a“  Create an instance of FFprobe.

Compiles FFprobe command line from passed arguments (executable path, options, inputs).
FFprobe executable by default is taken from ``PATH`` but can be overridden with an
absolute path. For more info about FFprobe command line format see
`here <https://ffmpeg.org/ffprobe.html#Synopsis>`_.

:param str executable: absolute path to ffprobe executable
:param iterable global_options: global options passed to ffmpeg executable; can be specified
    either as a list/tuple of strings or a space-separated string
:param dict inputs: a dictionary specifying one or more inputs as keys with their
    corresponding options as values
)r   r   r   N)Úsuperr   )r   r   r   r   r$   s       €r   r   ÚFFprobe.__init__ƒ   s   ø€ ô& 	‰Ñ JÐV\ÐÒ]r   rI   )ÚffprobeNN)r   r>   r   r?   r   r@   rA   rB   ©r%   rD   rE   rF   rG   r   rH   Ú__classcell__©r$   s   @r   rK   rK   €   sH   ø† ÙGð $Ø59ØBFð	^àð^ð 3ð^ð @ð	^ð
 
÷^ö ^r   rK   c                  ó   • \ rS rSrSrSrg)r2   é™   z3Raise when FFmpeg/FFprobe executable was not found.rI   N)r%   rD   rE   rF   rG   rH   rI   r   r   r2   r2   ™   s   † Ü=r   r2   c                  óD   ^ • \ rS rSrSr          SU 4S jjrSrU =r$ )r5   é�   zÞRaise when FFmpeg/FFprobe command line execution returns a non-zero exit code.

The resulting exception object will contain the attributes relates to command line execution:
``cmd``, ``exit_code``, ``stdout``, ``stderr``.
c                ó¼   >• Xl         X l        X0l        X@l        [	        U5      n[	        U5      nSR                  U R                   UUU5      n[        TU ]  U5        g )Nz2`{}` exited with status {}

STDOUT:
{}

STDERR:
{})r   Ú	exit_coder*   r+   Ú_safe_decodeÚformatrN   r   )	r   r   rY   r*   r+   Ústdout_displayÚstderr_displayÚmessager$   s	           €r   r   ÚFFRuntimeError.__init__¤   s\   ø€ ð ŒØ"ŒØŒØŒä% fÓ-ˆÜ% fÓ-ˆàL×SÑSØ�H‰HØØØó	
ˆô 	‰Ñ˜Õ!r   )r   rY   r+   r*   )
r   r>   rY   Úintr*   úbytes | str | Noner+   ra   rA   rB   rQ   rS   s   @r   r5   r5   �   sB   ø† ñð"àð"ð ð"ð #ð	"ð
 #ð"ð 
÷"õ "r   r5   c                ó¼   • / nU R                  5        HE  u  p4U[        U5      -  nU(       d  M  U(       a  UR                  S5        UR                  U5        MG     U$ )a®  Merge options with their corresponding arguments.

Iterates over the dictionary holding arguments (keys) and options (values). Merges each
options string with its corresponding argument.

:param dict args_opts_dict: a dictionary of arguments and options
:param dict kwargs: *input_option* - if specified prepends ``-i`` to input argument
:return: merged list of strings with arguments and their corresponding options
:rtype: list
z-i)Úitemsr   Úappend)Úargs_opts_dictr   ÚmergedÚargÚopts        r   r   r   ½   sV   € ð €Fà"×(Ñ(Ö*‰ˆØÔ$ SÓ)Ñ)ˆæÙæØ�M‰M˜$Ôà�‰�cÖñ +ð €Mr   c           
     ó  • U c  / $ [        U [        5      (       a  [        R                  " U 5      $ U(       aA  [	        [
        R                  " U  Vs/ s H  n[        R                  " U5      PM     sn6 5      $ [	        U 5      $ s  snf )aJ  Normalize options string or list of strings.

Splits `options` into a list of strings. If `split_mixed` is `True`, splits (flattens) mixed
options (i.e. list of strings with spaces) into separate items.

:param options: options string or list of strings
:param bool split_mixed: whether to split mixed options into separate items
)Ú
isinstancer>   ÚshlexÚsplitÚlistÚ	itertoolsÚchain)Úoptionsr   Úos      r   r   r   Û   sh   € ð �Øˆ	Ü	�GœS×	!Ñ	!Ü�{Š{˜7Ó#Ð#æÜœ	ŸšÁ'Ó)JÂ'¸Q¬%¯+ª+°a®.Á'Ñ)JÐKÓLÐLä˜“=Ð ùò *Ks   Á Bc                óV   • U c  g[        U [        5      (       a  U R                  SS9$ U $ )z1Convert FFmpeg output to text for error messages.Ú Úreplace)Úerrors)rj   ÚbytesÚdecode)Ústream_datas    r   rZ   rZ   ï   s2   € àÑØÜ�+œu×%Ñ%Ø×!Ñ!¨Ð!Ð3Ð3ØÐr   )F)re   z(Mapping[str, Sequence[str] | str | None]r   ÚboolrA   ú	list[str])rp   r?   r   ry   rA   rz   )rx   ra   rA   r>   )Ú
__future__r   r0   rn   rk   r   Útypingr   r   r   r   Úpsutilr   Ú__annotations__r	   ÚImportErrorr   rK   Ú	Exceptionr2   r5   r   r   rZ   rI   r   r   Ú<module>r�      s®   ðÞ "ã Û Û Û ß -Ó -ðÝà)Ó)ð €E÷j"ñ j"ôZ^ˆfô ^ô2> 	ô >ô"�Yô "ðD  %ðØ<ðàðð õö<!õ(øðE ó Ø×Ñ‚Eðús   ¥A7 Á7BÂB