Recherche avancée

Médias (91)

Autres articles (41)

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

  • Creating farms of unique websites

    13 avril 2011, par

    MediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
    This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...)

  • Other interesting software

    13 avril 2011, par

    We don’t claim to be the only ones doing what we do ... and especially not to assert claims to be the best either ... What we do, we just try to do it well and getting better ...
    The following list represents softwares that tend to be more or less as MediaSPIP or that MediaSPIP tries more or less to do the same, whatever ...
    We don’t know them, we didn’t try them, but you can take a peek.
    Videopress
    Website : http://videopress.com/
    License : GNU/GPL v2
    Source code : (...)

Sur d’autres sites (7613)

  • Is there a way to apply a curve bend in ffmpeg ?

    25 mars 2020, par stevendesu

    I have four cameras each feeding me a different portion of a basketball court. Due to the slight offset of the cameras physical locations and lens distortion around the edges of the camera, I cannot simply stitch the videos together without some kind of correction.

    I’ve looked into ffmpeg’s perspective filter, as well as the lenscorrection filter. In the former case it was only able to create a trapezoid, not the curved image I want. In the latter case using negative values to k1 and k2 seemed to be heading in the right direction, but it either disorted the top and bottom of the image to the point of being nonsensical noise, or it zoomed in to the image so much that I lost important details.

    For the sample picture below, ultimately I want the midcourt line (the blue vertical line on the right side) to be vertical, and I want the mess of wires on the white desk at the bottom to remain visible and identifiable.

    Given a video which looks like the following :

    enter image description here

    I wish to produce something like the following :

    enter image description here

    This image was made using the "Curve Bend" filter in GIMP, but I just eye-balled it - so it’s not perfect. Ideally once I get the exact parameters the midcourt line will be perfectly vertical

    When using the lenscorrection filter, no values for k1 and k2 seemed to get the effect I want :

    Negative k1, negative k2 :

    enter image description here

    Negative k1, positive k2 :

    enter image description here

    Positive k1, negative k2 :

    enter image description here

    Positive k1, positive k2 :

    enter image description here

    In general :

    • negative / negative distorted the image beyond recognition
    • negative / positive looked alright, but the midcourt line was off the screen and it wasn’t clear if any distortion had been applied
    • positive / negative looked the best, but while the top and bottom curved in the middle of the left and right actually bulged out, leaving the midcourt line distorted
    • positive / positive was the opposite of the desired effect
  • Evolution #4271 (Nouveau) : valider_url_distante => pouvoir déclarer des domaines distants et pas ...

    21 janvier 2019, par - Equipement

    Bonjour,

    La fonction valider_url_distante permet de déclarer des hosts distants :

    1. <span class="CodeRay"><span class="local-variable">$known_hosts</span> = pipeline(<span class="string"><span class="delimiter">'</span><span class="content">declarer_hosts_distants</span><span class="delimiter">'</span></span>, <span class="local-variable">$known_hosts</span>);
    2. </span>

    Télécharger

    C’est très bien, mais avec plusieurs centaines de hosts à déclarer (dont la liste varie dans le temps), cela devient compliqué à gérer.

    Serait-il possible d’avoir, en plus, la possibilité de déclarer des domaines distants ?

    Une première piste serait de pouvoir déclarer .example.com dans le pipeline pour inclure tous les *.example.com au lieu des les énumérer un par un.

    Une seconde piste consisterait à s’inspirer de la function need_proxy (via une constante avec la même syntaxe que pour le http_noproxy) :

    // Pour mémoire code actuel à conserver ...

    1. <span class="CodeRay">    <span class="local-variable">$is_known_host</span> = <span class="predefined-constant">false</span>;
    2.     <span class="keyword">foreach</span> (<span class="local-variable">$known_hosts</span> <span class="keyword">as</span> <span class="local-variable">$known_host</span>) {
    3.         <span class="local-variable">$parse_known</span> = <span class="predefined">parse_url</span>(<span class="local-variable">$known_host</span>);
    4.         <span class="keyword">if</span> (<span class="local-variable">$parse_known</span>
    5.           <span class="keyword">and</span> <span class="predefined">strtolower</span>(<span class="local-variable">$parse_known</span>[<span class="string"><span class="delimiter">'</span><span class="content">host</span><span class="delimiter">'</span></span>]) === <span class="predefined">strtolower</span>(<span class="local-variable">$parsed_url</span>[<span class="string"><span class="delimiter">'</span><span class="content">host</span><span class="delimiter">'</span></span>])) {
    6.             <span class="local-variable">$is_known_host</span> = <span class="predefined-constant">true</span>;
    7.             <span class="keyword">break</span>;
    8.         }
    9.     }
    10. </span>

    Télécharger

    // ... que l’on pourrait faire suivre de ce code (complètement inspiré de function need_proxy) :

    1. <span class="CodeRay">    <span class="keyword">if</span> (!<span class="local-variable">$is_known_host</span>) {
    2.                 <span class="local-variable">$known_domaines</span> = _DECLARER_DOMAINES_DISTANTS;
    3.  
    4.                 <span class="local-variable">$known_domaines</span> = <span class="predefined">str_replace</span>(<span class="string"><span class="delimiter">"</span><span class="char">\n</span><span class="delimiter">"</span></span>, <span class="string"><span class="delimiter">"</span><span class="content"> </span><span class="delimiter">"</span></span>, <span class="local-variable">$known_domaines</span>);
    5.                 <span class="local-variable">$known_domaines</span> = <span class="predefined">str_replace</span>(<span class="string"><span class="delimiter">"</span><span class="char">\r</span><span class="delimiter">"</span></span>, <span class="string"><span class="delimiter">"</span><span class="content"> </span><span class="delimiter">"</span></span>, <span class="local-variable">$known_domaines</span>);
    6.                 <span class="local-variable">$known_domaines</span> = <span class="string"><span class="delimiter">"</span><span class="content"> </span><span class="local-variable">$known_domaines</span><span class="content"> </span><span class="delimiter">"</span></span>;
    7.                 <span class="local-variable">$domain</span> = <span class="predefined">strtolower</span>(<span class="local-variable">$parsed_url</span>[<span class="string"><span class="delimiter">'</span><span class="content">host</span><span class="delimiter">'</span></span>]);
    8.  
    9.                 <span class="keyword">if</span> (<span class="predefined">strpos</span>(<span class="local-variable">$known_domaines</span>, <span class="string"><span class="delimiter">"</span><span class="content"> </span><span class="local-variable">$domain</span><span class="content"> </span><span class="delimiter">"</span></span>) !== <span class="predefined-constant">false</span>){
    10.                     <span class="local-variable">$is_known_host</span> = <span class="predefined-constant">true</span>;
    11.                 }
    12.  
    13.                 <span class="keyword">while</span> (<span class="predefined">strpos</span>(<span class="local-variable">$domain</span>, <span class="string"><span class="delimiter">'</span><span class="content">.</span><span class="delimiter">'</span></span>) !== <span class="predefined-constant">false</span>) {
    14.                         <span class="local-variable">$domain</span> = <span class="predefined">explode</span>(<span class="string"><span class="delimiter">'</span><span class="content">.</span><span class="delimiter">'</span></span>, <span class="local-variable">$domain</span>);
    15.                         <span class="predefined">array_shift</span>(<span class="local-variable">$domain</span>);
    16.                         <span class="local-variable">$domain</span> = <span class="predefined">implode</span>(<span class="string"><span class="delimiter">'</span><span class="content">.</span><span class="delimiter">'</span></span>, <span class="local-variable">$domain</span>);
    17.  
    18.                         <span class="keyword">if</span> (<span class="predefined">strpos</span>(<span class="local-variable">$known_domaines</span>, <span class="string"><span class="delimiter">"</span><span class="content"> .</span><span class="local-variable">$domain</span><span class="content"> </span><span class="delimiter">"</span></span>) !== <span class="predefined-constant">false</span>) {
    19.                             <span class="local-variable">$is_known_host</span> = <span class="predefined-constant">true</span>;
    20.                         }
    21.                 }
    22.         }
    23. </span>

    Télécharger

    Cordialement
    Equipement

  • Trying to convert code to be compatible with macOS by not using the .exe version of FFmpeg and FFmprobe. Cant open the .mp4 file when i go to run code

    9 juillet 2024, par Bruno Hawkins

    I am attempting to edit some code in python for extracting frames from a video (using parallel processing to make it faster) a friend created that works on windows, so that it can be used on macOS. However, i am running into some issues and i am not sure what the problem is.

    &#xA;

    Essentially, when i go to run the frame extractor and try to select a video in the formats specified, it wont let me select it.

    &#xA;

    i have commented my code best i can. i am an amateur programmer so apologies if it is straightforward.

    &#xA;

    import os&#xA;import subprocess&#xA;import multiprocessing&#xA;import tkinter as tk&#xA;from tkinter import ttk, filedialog, messagebox&#xA;&#xA;def extract_frames(video_path, output_folder, fps, start_time, duration, process_number):&#xA;    video_name = os.path.splitext(os.path.basename(video_path))[0]&#xA;    part_output_folder = os.path.join(output_folder, f"part_{process_number}")&#xA;    if not os.path.exists(part_output_folder):&#xA;        os.makedirs(part_output_folder)&#xA;&#xA;    # Using &#x27;ffmpeg&#x27; instead of &#x27;ffmpeg.exe&#x27; for macOS compatibility&#xA;    ffmpeg_command = [&#xA;        &#x27;ffmpeg&#x27;, &#x27;-ss&#x27;, str(start_time), &#x27;-t&#x27;, str(duration), &#x27;-i&#x27;, video_path, &#x27;-vf&#x27;, f&#x27;fps={fps}&#x27;,&#xA;        os.path.join(part_output_folder, f&#x27;{video_name}_frame_%07d.png&#x27;)&#xA;    ]&#xA;&#xA;    print(f"Running FFmpeg command: {&#x27; &#x27;.join(ffmpeg_command)}")&#xA;&#xA;    try:&#xA;        process = subprocess.run(ffmpeg_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)&#xA;        if process.returncode != 0:&#xA;            print(f"Cannot process the file {video_path}: {process.stderr.decode(&#x27;utf-8&#x27;)}")&#xA;            return part_output_folder, 0&#xA;    except Exception as e:&#xA;        print(f"Failed to run FFmpeg command: {str(e)}")&#xA;        return part_output_folder, 0&#xA;&#xA;    frame_count = len([f for f in os.listdir(part_output_folder) if f.endswith(&#x27;.png&#x27;)])&#xA;    return part_output_folder, frame_count&#xA;&#xA;def worker_function(queue, video_path, output_folder, fps, start_time, duration, process_number):&#xA;    result = extract_frames(video_path, output_folder, fps, start_time, duration, process_number)&#xA;    queue.put(result)&#xA;&#xA;def parallel_frame_extraction(video_path, output_folder, fps, num_processes):&#xA;    # Use &#x27;ffprobe&#x27; instead of &#x27;ffprobe.exe&#x27; for macOS compatibility&#xA;    ffprobe_command = [&#xA;        &#x27;ffprobe&#x27;, &#x27;-v&#x27;, &#x27;error&#x27;, &#x27;-select_streams&#x27;, &#x27;v:0&#x27;, &#x27;-show_entries&#x27;, &#x27;format=duration&#x27;, &#x27;-of&#x27;,&#xA;        &#x27;default=noprint_wrappers=1:nokey=1&#x27;, video_path&#xA;    ]&#xA;&#xA;    try:&#xA;        result = subprocess.run(ffprobe_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)&#xA;        duration = float(result.stdout.strip())&#xA;    except Exception as e:&#xA;        messagebox.showerror("Error", f"Failed to get video duration: {str(e)}")&#xA;        return&#xA;&#xA;    chunk_duration = duration / num_processes&#xA;    processes = []&#xA;    manager = multiprocessing.Manager()&#xA;    queue = manager.Queue()&#xA;&#xA;    if not os.path.exists(output_folder):&#xA;        os.makedirs(output_folder)&#xA;&#xA;    for i in range(num_processes):&#xA;        start_time = i * chunk_duration&#xA;        p = multiprocessing.Process(target=worker_function,&#xA;                                    args=(queue, video_path, output_folder, fps, start_time, chunk_duration, i))&#xA;        p.start()&#xA;        processes.append(p)&#xA;&#xA;    for p in processes:&#xA;        p.join()&#xA;&#xA;    global_frame_offset = 0&#xA;    while not queue.empty():&#xA;        part_output_folder, frame_count = queue.get()&#xA;        frame_files = sorted([f for f in os.listdir(part_output_folder) if f.endswith(&#x27;.png&#x27;)])&#xA;        for i, frame_file in enumerate(frame_files):&#xA;            new_name = os.path.join(output_folder,&#xA;                                    f&#x27;{os.path.basename(video_path)}_frame_{global_frame_offset &#x2B; i:07d}.png&#x27;)&#xA;            os.rename(os.path.join(part_output_folder, frame_file), new_name)&#xA;        global_frame_offset &#x2B;= frame_count&#xA;        os.rmdir(part_output_folder)&#xA;&#xA;    messagebox.showinfo("Complete",&#xA;                        f"Frame extraction completed for {video_path}. Total frames extracted: {global_frame_offset}")&#xA;&#xA;def start_frame_extraction():&#xA;    video_path = filedialog.askopenfilename(filetypes=[("Video files", "*.mp4;*.avi;*.mkv")])&#xA;    if not video_path:&#xA;        return&#xA;&#xA;    output_folder = output_folder_var.get()&#xA;    if not output_folder:&#xA;        return&#xA;&#xA;    fps = int(fps_var.get())&#xA;    num_processes = int(num_processes_var.get())&#xA;&#xA;    parallel_frame_extraction(video_path, output_folder, fps, num_processes)&#xA;&#xA;if __name__ == "__main__":&#xA;    root = tk.Tk()&#xA;    root.title("Frame Extraction")&#xA;&#xA;    output_folder_var = tk.StringVar()&#xA;    fps_var = tk.StringVar(value="1")&#xA;    num_processes_var = tk.StringVar(value="4")&#xA;&#xA;    def browse_output_folder():&#xA;        folder_selected = filedialog.askdirectory()&#xA;        output_folder_var.set(folder_selected)&#xA;&#xA;    tk.Label(root, text="Output Folder:").grid(row=0, column=0, padx=10, pady=10)&#xA;    tk.Entry(root, textvariable=output_folder_var, width=50).grid(row=0, column=1, padx=10, pady=10)&#xA;    tk.Button(root, text="Browse", command=browse_output_folder).grid(row=0, column=2, padx=10, pady=10)&#xA;&#xA;    tk.Label(root, text="FPS:").grid(row=1, column=0, padx=10, pady=10)&#xA;    tk.Entry(root, textvariable=fps_var, width=10).grid(row=1, column=1, padx=10, pady=10)&#xA;&#xA;    tk.Label(root, text="Number of Processes:").grid(row=2, column=0, padx=10, pady=10)&#xA;    tk.Entry(root, textvariable=num_processes_var, width=10).grid(row=2, column=1, padx=10, pady=10)&#xA;&#xA;    tk.Button(root, text="Start Frame Extraction", command=start_frame_extraction).grid(row=3, column=0, columnspan=3,&#xA;                                                                                        padx=10, pady=20)&#xA;&#xA;    root.mainloop()&#xA;

    &#xA;

    I tried changing the FFmpeg and FFmprobe path formats from

    &#xA;

    ffmpeg_path = os.path.join(os.path.dirname(__file__), &#x27;ffmpeg-7.0.1-essentials_build&#x27;, &#x27;bin&#x27;, &#x27;ffmpeg.exe&#x27;)&#xA;ffprobe_path = os.path.join(os.path.dirname(__file__), &#x27;ffmpeg-7.0.1-essentials_build&#x27;, &#x27;bin&#x27;, &#x27;ffprobe.exe&#x27;)&#xA;&#xA;

    &#xA;

    to

    &#xA;

    ffmpeg_command = [&#xA;    &#x27;ffmpeg&#x27;, &#x27;-ss&#x27;, str(start_time), &#x27;-t&#x27;, str(duration), &#x27;-i&#x27;, video_path, &#x27;-vf&#x27;, f&#x27;fps={fps}&#x27;,&#xA;    os.path.join(part_output_folder, f&#x27;{video_name}_frame_%07d.png&#x27;)&#xA;]&#xA;&#xA;ffprobe_command = [&#xA;    &#x27;ffprobe&#x27;, &#x27;-v&#x27;, &#x27;error&#x27;, &#x27;-select_streams&#x27;, &#x27;v:0&#x27;, &#x27;-show_entries&#x27;, &#x27;format=duration&#x27;, &#x27;-of&#x27;,&#xA;    &#x27;default=noprint_wrappers=1:nokey=1&#x27;, video_path&#xA;]&#xA;&#xA;

    &#xA;

    I found this online so im not sure if it is the correct thing to do.

    &#xA;

    Thanks for any help.

    &#xA;