Recherche avancée

Médias (91)

Autres articles (76)

  • MediaSPIP 0.1 Beta version

    25 avril 2011, par

    MediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
    The zip file provided here only contains the sources of MediaSPIP in its standalone version.
    To get a working installation, you must manually install all-software dependencies on the server.
    If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...)

  • MediaSPIP version 0.1 Beta

    16 avril 2011, par

    MediaSPIP 0.1 beta est la première version de MediaSPIP décrétée comme "utilisable".
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Pour avoir une installation fonctionnelle, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

  • Amélioration de la version de base

    13 septembre 2013

    Jolie sélection multiple
    Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
    Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...)

Sur d’autres sites (13336)

  • How to stop os.system() in Python ?

    30 septembre 2015, par 吴雨羲

    I want to stop the cmd command after 12 seconds. How to stop it ? My program doesn’t work.

    import multiprocessing
    import os
    import time


    def process():
       os.system('ffmpeg -i rtsp://218.204.223.237:554/live/1/66251FC11353191F/e7ooqwcfbqjoo80j.sdp -c copy dump.mp4')


    def stop():
       time.sleep(12)


    if __name__ == '__main__':
       p = multiprocessing.Process(target=process, args=())
       s = multiprocessing.Process(target=stop, args=())
       p.start()
       s.start()
       s.join()
       p.terminate()

    I change my program follow Pedro’s suggusetion @Pedro Lobito ,but it still doesn`t work.

    import shlex

    import subprocess
    import time

    command_line = 'ffmpeg -i rtsp://218.204.223.237:554/live/1/66251FC11353191F/e7ooqwcfbqjoo80j.sdp -c copy dump.mp4'

    proc = subprocess.Popen(shlex.split(command_line), shell=True)
    print '1' * 50
    time.sleep(2)  # <-- sleep for 12''
    print '2' * 50
    proc.terminate()  # <-- terminate the process
    print '3' * 50

    And the result in CMD is

    D:\wyx\workspace\python\ffrstp>python test1.py
    11111111111111111111111111111111111111111111111111
    ffmpeg version N-75563-g235381e Copyright (c) 2000-2015 the FFmpeg developers
     built with gcc 4.9.3 (GCC)
     configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
    isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
    le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --
    enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-l
    ibilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enab
    le-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --en
    able-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --ena
    ble-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc
    --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enabl
    e-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --ena
    ble-decklink --enable-zlib
     libavutil      55.  2.100 / 55.  2.100
     libavcodec     57.  3.100 / 57.  3.100
     libavformat    57.  2.100 / 57.  2.100
     libavdevice    57.  0.100 / 57.  0.100
     libavfilter     6.  8.100 /  6.  8.100
     libswscale      4.  0.100 /  4.  0.100
     libswresample   2.  0.100 /  2.  0.100
     libpostproc    54.  0.100 / 54.  0.100
    Input #0, rtsp, from 'rtsp://218.204.223.237:554/live/1/66251FC11353191F/e7ooqwc
    fbqjoo80j.sdp':
     Metadata:
       title           : RTSP Session
       comment         : Jabsco Stream(JCO-jy9757acx1eve7nm-a104aea23c1e17bbc776656
    f5069bbf7)
     Duration: N/A, start: 0.000000, bitrate: N/A
       Stream #0:0: Video: mpeg4 (Simple Profile), yuv420p, 352x288 [SAR 1:1 DAR 11
    :9], 10k tbr, 90k tbn, 10k tbc
    [mp4 @ 00bad520] Codec for stream 0 does not use global headers but container fo
    rmat requires global headers
    Output #0, mp4, to 'dump.mp4':
     Metadata:
       title           : RTSP Session
       comment         : Jabsco Stream(JCO-jy9757acx1eve7nm-a104aea23c1e17bbc776656
    f5069bbf7)
       encoder         : Lavf57.2.100
       Stream #0:0: Video: mpeg4 ( [0][0][0] / 0x0020), yuv420p, 352x288 [SAR 1:1 D
    AR 11:9], q=2-31, 10k tbr, 90k tbn, 90k tbc
    Stream mapping:
     Stream #0:0 -> #0:0 (copy)
    Press [q] to stop, [?] for help
    [mp4 @ 00bad520] pts has no value
    [mp4 @ 00bad520] Non-monotonous DTS in output stream 0:0; previous: 0, current:
    0; changing to 1. This may result in incorrect timestamps in the output file.
    [mp4 @ 00bad520] Non-monotonous DTS in output stream 0:0; previous: 1, current:
    0; changing to 2. This may result in incorrect timestamps in the output file.
    frame=   30 fps=0.0 q=-1.0 size=      63kB time=00:00:02.33 bitrate= 220.4kbits/
    frame=   36 fps= 31 q=-1.0 size=      68kB time=00:00:02.95 bitrate= 187.9kbits/
    frame=   42 fps= 24 q=-1.0 size=      73kB time=00:00:03.52 bitrate= 169.6kbits/
    frame=   47 fps= 20 q=-1.0 size=      90kB time=00:00:04.10 bitrate= 178.9kbits/
    frame=   53 fps= 19 q=-1.0 size=      95kB time=00:00:04.63 bitrate= 167.2kbits/
    22222222222222222222222222222222222222222222222222
    33333333333333333333333333333333333333333333333333

    D:\wyx\workspace\python\ffrstp>frame=   58 fps= 17 q=-1.0 size=      99kB time=0
    frame=   64 fps= 16 q=-1.0 size=     104kB time=00:00:05.72 bitrate= 149.0kbits/
    frame=   70 fps= 15 q=-1.0 size=     122kB time=00:00:06.36 bitrate= 156.7kbits/
    frame=   76 fps= 15 q=-1.0 size=     127kB time=00:00:06.92 bitrate= 150.2kbits/
    frame=   82 fps= 14 q=-1.0 size=     132kB time=00:00:07.55 bitrate= 143.2kbits/
    [rtsp @ 00adb3e0] max delay reached. need to consume packet
    [NULL @ 00add8c0] RTP: missed 7 packets
    frame=   86 fps= 13 q=-1.0 size=     135kB time=00:00:07.95 bitrate= 139.5kbits/
    [rtsp @ 00adb3e0] max delay reached. need to consume packet
    [NULL @ 00add8c0] RTP: missed 3 packets

    Maybe ffmpeg can reconnection. Can I stop it like ’Ctrl + C’ ?
    When I press ’Ctrl+C’,the result is

    22222222222222222222222222222222222222222222222222
    33333333333333333333333333333333333333333333333333

    D:\wyx\workspace\python\ffrstp>frame=   58 fps= 17 q=-1.0 size=      99kB time=0
    frame=   64 fps= 16 q=-1.0 size=     104kB time=00:00:05.72 bitrate= 149.0kbits/
    frame=   70 fps= 15 q=-1.0 size=     122kB time=00:00:06.36 bitrate= 156.7kbits/
    frame=   76 fps= 15 q=-1.0 size=     127kB time=00:00:06.92 bitrate= 150.2kbits/
    frame=   82 fps= 14 q=-1.0 size=     132kB time=00:00:07.55 bitrate= 143.2kbits/
    [rtsp @ 00adb3e0] max delay reached. need to consume packet
    [NULL @ 00add8c0] RTP: missed 7 packets
    frame=   86 fps= 13 q=-1.0 size=     135kB time=00:00:07.95 bitrate= 139.5kbits/
    [rtsp @ 00adb3e0] max delay reached. need to consume packet
    [NULL @ 00add8c0] RTP: missed 3 packets
    [rtsp @ 00adb3e0] max delay reached. need to consume packet
    [NULL @ 00add8c0] RTP: missed 1 packets
    frame=   89 fps= 13 q=-1.0 size=     138kB time=00:00:08.35 bitrate= 135.3kbits/
    [rtsp @ 00adb3e0] max delay reached. need to consume packet
    [NULL @ 00add8c0] RTP: missed 1 packets
    [rtsp @ 00adb3e0] max delay reached. need to consume packet
    [NULL @ 00add8c0] RTP: missed 3 packets
    [rtsp @ 00adb3e0] max delay reached. need to consume packet
    [NULL @ 00add8c0] RTP: missed 5 packets
    [rtsp @ 00adb3e0] max delay reached. need to consume packet
    [NULL @ 00add8c0] RTP: missed 3 packets
    [rtsp @ 00adb3e0] max delay reached. need to consume packet
    [NULL @ 00add8c0] RTP: missed 1 packets
    frame=   92 fps= 12 q=-1.0 size=     144kB time=00:00:09.15 bitrate= 128.7kbits/
    frame=   93 fps= 11 q=-1.0 size=     145kB time=00:00:09.58 bitrate= 123.8kbits/
    [rtsp @ 00adb3e0] max delay reached. need to consume packet
    [NULL @ 00add8c0] RTP: missed 1 packets
    [rtsp @ 00adb3e0] max delay reached. need to consume packet
    [NULL @ 00add8c0] RTP: missed 2 packets


    D:\wyx\workspace\python\ffrstp>[rtsp @ 00adb3e0] max delay reached. need to cons
    ume packet
    [NULL @ 00add8c0] RTP: missed 12 packets
    frame=   96 fps= 11 q=-1.0 size=     148kB time=00:00:10.43 bitrate= 116.2kbits/
    frame=   96 fps=9.2 q=-1.0 Lsize=     151kB time=00:00:10.43 bitrate= 118.3kbits
    /s
    video:148kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing o
    verhead: 1.913398%
    Exiting normally, received signal 2.
  • FileNotFoundError : [WinError 2] The system cannot find the file specified - FFMPEG

    5 avril 2024, par shiftyscales

    I am running a script using conda environment on Windows and getting this error (stack trace below), which is apparently caused by python executable not being able to find the ffmpeg.exe. There are numerous questions about this, but none of the solutions unfortunately worked for me, so I hope someone has fresh ideas.

    


    What I tried :

    


      

    • conda install -c conda-forge ffmpeg (after this I can run ffmpeg in command line, but still getting the error)
    • 


    • pip install ffmpeg-python
    • 


    • Added the folder where ffmpeg.exe is located in conda env to the Windows Path as well as to sys.path in python.
    • 


    • copied the same ffmpeg.exe a) to the location of python.exe in conda env, b) to the location of the script I am running, c) to the location of subprocess.py.
    • 


    • Downloaded ffmpeg windows binary and repeated the last two steps with that file.
    • 


    


    Is there anything else that I can try to make it work ?

    


    ---------------------------------------------------------------------------&#xA;FileNotFoundError                         Traceback (most recent call last)&#xA;Cell In[10], line 22&#xA;     19 truncate_second = 8.2         # Video end = start_second &#x2B; truncate_second&#xA;     21 # Extract Video CAVP Features &amp; New Video Path:&#xA;---> 22 cavp_feats, new_video_path = extract_cavp(video_path, start_second, truncate_second, tmp_path=tmp_path)&#xA;&#xA;File D:\Software\Anaconda\envs\diff_foley\Lib\site-packages\torch\nn\modules\module.py:1518, in Module._wrapped_call_impl(self, *args, **kwargs)&#xA;   1516     return self._compiled_call_impl(*args, **kwargs)  # type: ignore[misc]&#xA;   1517 else:&#xA;-> 1518     return self._call_impl(*args, **kwargs)&#xA;&#xA;File D:\Software\Anaconda\envs\diff_foley\Lib\site-packages\torch\nn\modules\module.py:1527, in Module._call_impl(self, *args, **kwargs)&#xA;   1522 # If we don&#x27;t have any hooks, we want to skip the rest of the logic in&#xA;   1523 # this function, and just call forward.&#xA;   1524 if not (self._backward_hooks or self._backward_pre_hooks or self._forward_hooks or self._forward_pre_hooks&#xA;   1525         or _global_backward_pre_hooks or _global_backward_hooks&#xA;   1526         or _global_forward_hooks or _global_forward_pre_hooks):&#xA;-> 1527     return forward_call(*args, **kwargs)&#xA;   1529 try:&#xA;   1530     result = None&#xA;&#xA;File D:\Software\Anaconda\envs\diff_foley\Lib\site-packages\torch\utils\_contextlib.py:115, in context_decorator.<locals>.decorate_context(*args, **kwargs)&#xA;    112 @functools.wraps(func)&#xA;    113 def decorate_context(*args, **kwargs):&#xA;    114     with ctx_factory():&#xA;--> 115         return func(*args, **kwargs)&#xA;&#xA;File D:\Work\DIff-Foley\Diff-Foley\inference\demo_util.py:131, in Extract_CAVP_Features.forward(self, video_path, start_second, truncate_second, tmp_path)&#xA;    129 print("truncate second: ", truncate_second)&#xA;    130 # Load the video, change fps:&#xA;--> 131 video_path_low_fps = reencode_video_with_diff_fps(video_path, self.tmp_path, self.fps, start_second, truncate_second)&#xA;    132 video_path_high_fps = reencode_video_with_diff_fps(video_path, self.tmp_path, 21.5, start_second, truncate_second)&#xA;    134 # read the video:&#xA;&#xA;File D:\Work\DIff-Foley\Diff-Foley\inference\demo_util.py:42, in reencode_video_with_diff_fps(video_path, tmp_path, extraction_fps, start_second, truncate_second)&#xA;     31 def reencode_video_with_diff_fps(video_path: str, tmp_path: str, extraction_fps: int, start_second, truncate_second) -> str:&#xA;     32     &#x27;&#x27;&#x27;Reencodes the video given the path and saves it to the tmp_path folder.&#xA;     33 &#xA;     34     Args:&#xA;   (...)&#xA;     40         str: The path where the tmp file is stored. To be used to load the video from&#xA;     41     &#x27;&#x27;&#x27;&#xA;---> 42     assert which_ffmpeg() != &#x27;&#x27;, &#x27;Is ffmpeg installed? Check if the conda environment is activated.&#x27;&#xA;     43     # assert video_path.endswith(&#x27;.mp4&#x27;), &#x27;The file does not end with .mp4. Comment this if expected&#x27;&#xA;     44     # create tmp dir if doesn&#x27;t exist&#xA;     45     os.makedirs(tmp_path, exist_ok=True)&#xA;&#xA;File D:\Work\DIff-Foley\Diff-Foley\inference\demo_util.py:26, in which_ffmpeg()&#xA;     20 def which_ffmpeg() -> str:&#xA;     21     &#x27;&#x27;&#x27;Determines the path to ffmpeg library&#xA;     22 &#xA;     23     Returns:&#xA;     24         str -- path to the library&#xA;     25     &#x27;&#x27;&#x27;&#xA;---> 26     result = subprocess.run([&#x27;which&#x27;, &#x27;ffmpeg&#x27;], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)&#xA;     27     ffmpeg_path = result.stdout.decode(&#x27;utf-8&#x27;).replace(&#x27;\n&#x27;, &#x27;&#x27;)&#xA;     28     return ffmpeg_path&#xA;&#xA;File D:\Software\Anaconda\envs\diff_foley\Lib\subprocess.py:548, in run(input, capture_output, timeout, check, *popenargs, **kwargs)&#xA;    545     kwargs[&#x27;stdout&#x27;] = PIPE&#xA;    546     kwargs[&#x27;stderr&#x27;] = PIPE&#xA;--> 548 with Popen(*popenargs, **kwargs) as process:&#xA;    549     try:&#xA;    550         stdout, stderr = process.communicate(input, timeout=timeout)&#xA;&#xA;File D:\Software\Anaconda\envs\diff_foley\Lib\subprocess.py:1026, in Popen.__init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, user, group, extra_groups, encoding, errors, text, umask, pipesize, process_group)&#xA;   1022         if self.text_mode:&#xA;   1023             self.stderr = io.TextIOWrapper(self.stderr,&#xA;   1024                     encoding=encoding, errors=errors)&#xA;-> 1026     self._execute_child(args, executable, preexec_fn, close_fds,&#xA;   1027                         pass_fds, cwd, env,&#xA;   1028                         startupinfo, creationflags, shell,&#xA;   1029                         p2cread, p2cwrite,&#xA;   1030                         c2pread, c2pwrite,&#xA;   1031                         errread, errwrite,&#xA;   1032                         restore_signals,&#xA;   1033                         gid, gids, uid, umask,&#xA;   1034                         start_new_session, process_group)&#xA;   1035 except:&#xA;   1036     # Cleanup if the child failed starting.&#xA;   1037     for f in filter(None, (self.stdin, self.stdout, self.stderr)):&#xA;&#xA;File D:\Software\Anaconda\envs\diff_foley\Lib\subprocess.py:1538, in Popen._execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, unused_restore_signals, unused_gid, unused_gids, unused_uid, unused_umask, unused_start_new_session, unused_process_group)&#xA;   1536 # Start the process&#xA;   1537 try:&#xA;-> 1538     hp, ht, pid, tid = _winapi.CreateProcess(executable, args,&#xA;   1539                              # no special security&#xA;   1540                              None, None,&#xA;   1541                              int(not close_fds),&#xA;   1542                              creationflags,&#xA;   1543                              env,&#xA;   1544                              cwd,&#xA;   1545                              startupinfo)&#xA;   1546 finally:&#xA;   1547     # Child is launched. Close the parent&#x27;s copy of those pipe&#xA;   1548     # handles that only the child should have open.  You need&#xA;   (...)&#xA;   1551     # pipe will not close when the child process exits and the&#xA;   1552     # ReadFile will hang.&#xA;   1553     self._close_pipe_fds(p2cread, p2cwrite,&#xA;   1554                          c2pread, c2pwrite,&#xA;   1555                          errread, errwrite)&#xA;&#xA;FileNotFoundError: [WinError 2] The system cannot find the file specified&#xA;</locals>

    &#xA;

  • Révision 116123 : cas particulier du site, on peut associer au site 0 (logo du site)

    26 juillet 2019, par cedric@yterium.com