Recherche avancée

Médias (29)

Mot : - Tags -/Musique

Autres articles (32)

  • La file d’attente de SPIPmotion

    28 novembre 2010, par

    Une file d’attente stockée dans la base de donnée
    Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
    Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...)

  • Contribute to documentation

    13 avril 2011

    Documentation is vital to the development of improved technical capabilities.
    MediaSPIP welcomes documentation by users as well as developers - including : critique of existing features and functions articles contributed by developers, administrators, content producers and editors screenshots to illustrate the above translations of existing documentation into other languages
    To contribute, register to the project users’ mailing (...)

  • Selection of projects using MediaSPIP

    2 mai 2011, par

    The examples below are representative elements of MediaSPIP specific uses for specific projects.
    MediaSPIP farm @ Infini
    The non profit organizationInfini develops hospitality activities, internet access point, training, realizing innovative projects in the field of information and communication technologies and Communication, and hosting of websites. It plays a unique and prominent role in the Brest (France) area, at the national level, among the half-dozen such association. Its members (...)

Sur d’autres sites (4617)

  • random_seed : Improve behaviour with small timer increments with high precision timers

    29 janvier, par Martin Storsjö
    random_seed : Improve behaviour with small timer increments with high precision timers
    

    On a Zen 5, on Ubuntu 24.04 (with CLOCKS_PER_SEC 1000000), the
    value of clock() in this loop increments by 0 most of the time,
    and when it does increment, it usually increments by 1 compared
    to the previous round.

    Due to the "last_t + 2*last_td + (CLOCKS_PER_SEC > 1000) >= t"
    expression, we only manage to take one step forward in this loop
    (incrementing i) if clock() increments by 2, while it incremented
    by 0 in the previous iteration (last_td).

    This is similar to the change done in
    c4152fc42e480c41efb7f761b1bbe5f0bc43d5bc, to speed it up on
    systems with very small CLOCKS_PER_SEC. However in this case,
    CLOCKS_PER_SEC is still very large, but the machine is fast enough
    to hit every clock increment repeatedly.

    For this case, use the number of repetitions of each timer value
    as entropy source ; require a change in the number of repetitions
    in order to proceed to the next buffer index.

    This helps the fate-random-seed test to actually terminate within
    a reasonable time on such a system (where it previously could hang,
    running for many minutes).

    Signed-off-by : Martin Storsjö <martin@martin.st>

    • [DH] libavutil/random_seed.c
  • FFMpeg gets stuck while using c# but not shell

    18 juin 2024, par Internal

    I'm working on a C# project where I need to run FFmpeg commands to process videos. The FFmpeg command works perfectly fine when executed directly in the shell, but it hangs when run from my C# application. I suspect the issue is related to the output pipes getting full.

    &#xA;

    Here is the FFmpeg command I'm using :

    &#xA;

    shell&#xA;C:\path\to\ffmpeg.exe -f concat -safe 0 -i "C:\path\to\list.txt" -vf "scale=1080x1920,setsar=1" -c:v libx264 -pix_fmt yuv420p -c:a aac -ar 44100 -ac 2 "C:\path\to\output.mp4"

    &#xA;

    And here is my C# code :

    &#xA;

    private static async Task _ExecuteFfmpegCommand(string arguments) {&#xA;    const string EXECUTABLE_NAME = "ffmpeg.exe";&#xA;    var executableFile = FfmpegPath.File(EXECUTABLE_NAME);&#xA;    await DownloadSercvice.EnsureFileExist(executableFile, FfmpegURI);&#xA;    arguments = $"-loglevel quiet {arguments}";&#xA;&#xA;    using var process = new Process {&#xA;        StartInfo = new ProcessStartInfo {&#xA;            FileName = executableFile.FullName,&#xA;            Arguments = arguments,&#xA;            UseShellExecute = false,&#xA;            CreateNoWindow = true,&#xA;            RedirectStandardOutput = true,&#xA;            RedirectStandardError = true&#xA;        }&#xA;    };&#xA;&#xA;    var command = $"{process.StartInfo.FileName} {process.StartInfo.Arguments}";&#xA;    Console.WriteLine($"This is my process command: {command}");&#xA;&#xA;    var outputTask = new TaskCompletionSource<string>();&#xA;    var errorTask = new TaskCompletionSource<string>();&#xA;&#xA;    process.OutputDataReceived &#x2B;= (sender, e) => {&#xA;        if (e.Data == null)            &#xA;            outputTask.SetResult(null);            &#xA;        else            &#xA;            Console.WriteLine(e.Data);            &#xA;    };&#xA;&#xA;    process.ErrorDataReceived &#x2B;= (sender, e) => {&#xA;        if (e.Data == null)            &#xA;            errorTask.SetResult(null);            &#xA;        else            &#xA;            Console.WriteLine(e.Data);            &#xA;    };&#xA;&#xA;    process.Start();&#xA;    process.BeginOutputReadLine();&#xA;    process.BeginErrorReadLine();&#xA;&#xA;    await process.WaitForExitAsync();&#xA;&#xA;    var output = await outputTask.Task;&#xA;    var error = await errorTask.Task;&#xA;&#xA;    if (process.ExitCode != 0 || !string.IsNullOrWhiteSpace(error)) {&#xA;        throw new InvalidOperationException($"FFMPEG Error(0x{process.ExitCode:X8}): {error}") {&#xA;            Data = {&#xA;            { "Output", output },&#xA;            { "Error", error },&#xA;            { "ExitCode", process.ExitCode }&#xA;        }&#xA;        };&#xA;    }&#xA;}&#xA;</string></string>

    &#xA;

    Issue :&#xA;The process hangs and does not complete execution. I suspect the FFmpeg process's output pipes (stdout and stderr) are getting full, causing the hang. I've tried setting the log level to error, but it didn't resolve the issue.&#xA;I got that info from here : ffmpeg hangs when run in background&#xA;Solutions Tried :

    &#xA;

    Set -loglevel error in the FFmpeg command to reduce verbosity.&#xA;Set -loglever quiet in the FFmpeg command (to test if that may work)

    &#xA;

    Handled OutputDataReceived and ErrorDataReceived events to read the output asynchronously.&#xA;Questions :

    &#xA;

    How can I prevent the FFmpeg process from hanging due to full output pipes ?&#xA;Are there better ways to handle the stdout and stderr of the FFmpeg process in C# ?&#xA;Any help or suggestions on how to resolve this issue would be greatly appreciated !

    &#xA;

  • 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.

    &#xA;

    What I tried :

    &#xA;

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

    • pip install ffmpeg-python
    • &#xA;

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

    • 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.
    • &#xA;

    • Downloaded ffmpeg windows binary and repeated the last two steps with that file.
    • &#xA;

    &#xA;

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

    &#xA;

    ---------------------------------------------------------------------------&#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;