Recherche avancée

Médias (2)

Mot : - Tags -/media

Autres articles (6)

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

  • 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 : (...)

  • Sélection de projets utilisant MediaSPIP

    29 avril 2011, par

    Les exemples cités ci-dessous sont des éléments représentatifs d’usages spécifiques de MediaSPIP pour certains projets.
    Vous pensez avoir un site "remarquable" réalisé avec MediaSPIP ? Faites le nous savoir ici.
    Ferme MediaSPIP @ Infini
    L’Association Infini développe des activités d’accueil, de point d’accès internet, de formation, de conduite de projets innovants dans le domaine des Technologies de l’Information et de la Communication, et l’hébergement de sites. Elle joue en la matière un rôle unique (...)

Sur d’autres sites (2681)

  • MAINTAINERS : Split project server admin list

    6 août 2022, par Michael Niedermayer
    MAINTAINERS : Split project server admin list
    

    This updates the list closer to reality.
    Iam not a professional server admin, iam happy to help maintain the box as i have
    done in the past. But iam not qualified nor volunteering to fix sudden problems
    nor do i do major upgrades (i lack the experience to recover the box remotely if
    something goes wrong) and also iam not maintaining backups ATM (our backup system
    had a RAID-5 failure, raz is working on setting a new one up)

    Maybe this should be signaled in a different way than spliting the lines but ATM
    people ping me if something is wrong and what i do is mainly mail/ping raz
    and try to find another root admin so raz is not the only active & professional
    admin on the team. It would be more efficient if people contact raz and others
    directly instead of depending on my waking up and forwarding a "ffmpeg.org" is down note

    Signed-off-by : Michael Niedermayer <michael@niedermayer.cc>

    • [DH] MAINTAINERS
  • Video Frame-by-Frame Deraining with MFDNet in Python

    28 octobre 2024, par JimmyHu

    As this CodeReview question mentioned, I am trying to modify the code to process frame-by-frame rain streaks removal in a video. FFmpeg package is used in this code.

    &#xA;

    import argparse&#xA;import os&#xA;import time&#xA;&#xA;import cv2&#xA;import ffmpeg&#xA;import numpy as np&#xA;import torch&#xA;from skimage import img_as_ubyte&#xA;from torch.utils.data import DataLoader&#xA;from tqdm import tqdm&#xA;&#xA;import utils&#xA;from data_RGB import get_test_data&#xA;from MFDNet import HPCNet as mfdnet&#xA;&#xA;&#xA;def process_video_frame_by_frame(input_file, output_file, model_restoration):&#xA;    """&#xA;    Decodes a video frame by frame, processes each frame,&#xA;    and re-encodes to a new video.&#xA;&#xA;    Args:&#xA;        input_file: Path to the input video file.&#xA;        output_file: Path to the output video file.&#xA;    """&#xA;    try:&#xA;        # Probe for video information&#xA;        probe = ffmpeg.probe(input_file)&#xA;        video_stream = next((stream for stream in probe[&#x27;streams&#x27;] if stream[&#x27;codec_type&#x27;] == &#x27;video&#x27;), None)&#xA;        width = int(video_stream[&#x27;width&#x27;])&#xA;        height = int(video_stream[&#x27;height&#x27;])&#xA;&#xA;        # Input&#xA;        process1 = (&#xA;            ffmpeg&#xA;            .input(input_file)&#xA;            .output(&#x27;pipe:&#x27;, format=&#x27;rawvideo&#x27;, pix_fmt=&#x27;rgb24&#x27;)&#xA;            .run_async(pipe_stdout=True)&#xA;        )&#xA;&#xA;        # Output&#xA;        process2 = (&#xA;            ffmpeg&#xA;            .input(&#x27;pipe:&#x27;, format=&#x27;rawvideo&#x27;, pix_fmt=&#x27;rgb24&#x27;, s=&#x27;{}x{}&#x27;.format(width, height))&#xA;            .output(output_file, vcodec=&#x27;libx264&#x27;, pix_fmt=&#x27;yuv420p&#x27;)&#xA;            .overwrite_output()&#xA;            .run_async(pipe_stdin=True)&#xA;        )&#xA;&#xA;        # Process frame (deraining processing)&#xA;        while in_bytes := process1.stdout.read(width * height * 3):&#xA;            in_frame = torch.frombuffer(in_bytes, dtype=torch.uint8).float().reshape((1, 3, width, height))&#xA;            restored = model_restoration(torch.div(in_frame, 255).to(device=&#x27;cuda&#x27;))&#xA;            restored = torch.clamp(restored[0], 0, 1)&#xA;            restored = restored.cpu().detach().numpy()&#xA;            restored *= 255&#xA;            out_frame = restored&#xA;            np.reshape(out_frame, (3, width, height))&#xA;&#xA;            # Encode and write the frame&#xA;            process2.stdin.write(&#xA;                out_frame&#xA;                .astype(np.uint8)&#xA;                .tobytes()&#xA;            )&#xA;            &#xA;        # Close streams&#xA;        process1.stdout.close()&#xA;        process2.stdin.close()&#xA;        process1.wait()&#xA;        process2.wait()&#xA;&#xA;    except ffmpeg.Error as e:&#xA;        print(&#x27;stdout:&#x27;, e.stdout.decode(&#x27;utf8&#x27;))&#xA;        print(&#x27;stderr:&#x27;, e.stderr.decode(&#x27;utf8&#x27;))&#xA;&#xA;if __name__ == &#x27;__main__&#x27;:&#xA;    parser = argparse.ArgumentParser(description=&#x27;Image Deraining using MPRNet&#x27;)&#xA;&#xA;    parser.add_argument(&#x27;--weights&#x27;, default=&#x27;./checkpoints/checkpoints_mfd.pth&#x27;, type=str,&#xA;                        help=&#x27;Path to weights&#x27;)&#xA;    parser.add_argument(&#x27;--gpus&#x27;, default=&#x27;0&#x27;, type=str, help=&#x27;CUDA_VISIBLE_DEVICES&#x27;)&#xA;&#xA;    args = parser.parse_args()&#xA;&#xA;    os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"&#xA;    os.environ["CUDA_VISIBLE_DEVICES"] = args.gpus&#xA;&#xA;    model_restoration = mfdnet()&#xA;    utils.load_checkpoint(model_restoration, args.weights)&#xA;    print("===>Testing using weights: ", args.weights)&#xA;&#xA;    model_restoration.eval().cuda()&#xA;    &#xA;    input_video = "Input_video.mp4"&#xA;    output_video = &#x27;output_video.mp4&#x27;&#xA;&#xA;    process_video_frame_by_frame(input_video, output_video, model_restoration)&#xA;

    &#xA;

    Let's focus on the while loop part :

    &#xA;

    The version of the code snippet above can be executed without error. In the next step, I am trying to follow 301_Moved_Permanently's answer to make the usage of torch.save. Therefore, the contents of while loop comes as the following code :

    &#xA;

            # Process frame (deraining processing)&#xA;        while in_bytes := process1.stdout.read(width * height * 3):&#xA;            in_frame = torch.frombuffer(in_bytes, dtype=torch.uint8).float().reshape((1, 3, width, height))&#xA;            restored = model_restoration(torch.div(in_frame, 255).to(device=&#x27;cuda&#x27;))&#xA;            restored = torch.clamp(restored[0], 0, 1)&#xA;            out_frame = torch.mul(restored.cpu().detach(), 255).reshape(3, width, height).byte()&#xA;            torch.save(out_frame, process2.stdin)&#xA;

    &#xA;

    Out of memory error happened with the following message :

    &#xA;

    &#xA;

    torch.OutOfMemoryError : CUDA out of memory. Tried to allocate 676.00 MiB. GPU 0 has a total capacity of 23.99 GiB of which 0 bytes is free. Of the allocated memory 84.09 GiB is allocated by PyTorch, and 1.21 GiB is reserved by PyTorch but unallocated.

    &#xA;

    &#xA;

    To diagnostics the error, I removed the last two lines of code :

    &#xA;

            # Process frame (deraining processing)&#xA;        while in_bytes := process1.stdout.read(width * height * 3):&#xA;            in_frame = torch.frombuffer(in_bytes, dtype=torch.uint8).float().reshape((1, 3, width, height))&#xA;            restored = model_restoration(torch.div(in_frame, 255).to(device=&#x27;cuda&#x27;))&#xA;            restored = torch.clamp(restored[0], 0, 1)&#xA;

    &#xA;

    The out of memory error still happened. This is weird to me. My understanding of the executable version code, the line restored = restored.cpu().detach().numpy() is to transfer the restored data in GPU memory to main memory and then convert it to numpy format. Why I remove this line of code then out of memory error happened ?

    &#xA;

    The hardware and software specification I used is as follows :

    &#xA;

      &#xA;
    • CPU : 12th Gen Intel(R) Core(TM) i9-12900K 3.20 GHz

      &#xA;

    • &#xA;

    • RAM : 128 GB (128 GB usable)

      &#xA;

    • &#xA;

    • Graphic card : NVIDIA GeForce RTX 4090

      &#xA;

    • &#xA;

    • OS : Windows 11 Pro 22H2, OS build : 22621.4317

      &#xA;

    • &#xA;

    • Pytorch version :

      &#xA;

      > python -c "import torch; print(torch.__version__)"&#xA;2.5.0&#x2B;cu124&#xA;

      &#xA;

    • &#xA;

    &#xA;

  • Why does File upload for moving image and Audio to tmp PHP folder work on Windows but only image upload portion works on Mac using MAMP ?

    31 mai 2021, par Yazdan

    So according to my colleague who tested this on Windows says it works perfectly fine , but in my case when I use it on a Mac with MAMP for Moodle , the image files get uploaded to the correct destination folder without an issue whereas the audio files don't move from the tmp folder to the actual destination folder and to check if this was the case ... I just changed and gave a fixed path instead of $fileTmpLoc and the file made it to the correct destination. Sorry I know the first half of the code isn't the main issue but I still wanted to post the whole code so one could understand it easily, moreover I am just beginning to code so please "have a bit of patience with me" . Thanks in advance

    &#xA;

    &#xA;// this file contains upload function &#xA;// checks if the file exists in server&#xA;include("../db/database.php");&#xA;require_once(dirname(__FILE__) . &#x27;/../../../config.php&#x27;);&#xA;global $IP;&#xA;&#xA;$ajaxdata = $_POST[&#x27;mediaUpload&#x27;];&#xA;&#xA;$FILENAME = $ajaxdata[1];&#xA;$IMAGE=$ajaxdata[0];&#xA;// an array to check which category the media belongs too&#xA;$animal= array("bird","cat","dog","horse","sheep","cow","elephant","bear","giraffe","zebra");&#xA;$allowedExts = array("mp3","wav");&#xA;$temp = explode(".", $_FILES["audio"]["name"]);&#xA;$extension = end($temp);&#xA;&#xA;&#xA;&#xA;$test = $_FILES["audio"]["type"]; &#xA;&#xA;&#xA;if (&#xA;   $_FILES["audio"]["type"] == "audio/wav"||&#xA;   $_FILES["audio"]["type"] == "audio/mp3"||&#xA;   $_FILES["audio"]["type"] == "audio/mpeg"&#xA;   &amp;&amp;&#xA;   in_array($extension, $allowedExts)&#xA;   )&#xA;   {&#xA;&#xA;       // if the name detected by object detection is present in the animal array&#xA;       // then initialize target path to animal database or to others&#xA;       if (in_array($FILENAME, $animal)) &#xA;       { &#xA;           $image_target_dir = "image_dir/";&#xA;           $audio_target_dir = "audio_dir/";&#xA;       } &#xA;       else&#xA;       { &#xA;           $image_target_dir = "other_image_dir/";&#xA;           $audio_target_dir = "other_audio_dir/";&#xA;       } &#xA;       // Get file path&#xA;       &#xA;       $img = $IMAGE;&#xA;       // decode base64 image&#xA;       $img = str_replace(&#x27;data:image/png;base64,&#x27;, &#x27;&#x27;, $img);&#xA;       $img = str_replace(&#x27; &#x27;, &#x27;&#x2B;&#x27;, $img);&#xA;       $image_data = base64_decode($img);&#xA;&#xA;       //$extension  = pathinfo( $_FILES["fileUpload"]["name"], PATHINFO_EXTENSION ); // jpg&#xA;       $image_extension = "png";&#xA;       $image_target_file =$image_target_dir . basename($FILENAME . "." . $image_extension);&#xA;       $image_file_upload = "http://localhost:8888/moodle310/blocks/testblock/classes/".$image_target_file;&#xA;       &#xA;       &#xA;       $audio_extension ="mp3";&#xA;       $audio_target_file= $audio_target_dir . basename($FILENAME. "." . $audio_extension) ;&#xA;       $audio_file_upload = "http://localhost:8888/moodle310/blocks/testblock/classes/".$audio_target_file;&#xA;&#xA;       // file size limit&#xA;       if(($_FILES["audio"]["size"])&lt;=51242880)&#xA;       {&#xA;&#xA;           $fileName = $_FILES["audio"]["name"]; // The file name&#xA;           $fileTmpLoc = $_FILES["audio"]["tmp_name"]; // File in the PHP tmp folder&#xA;           $fileType = $_FILES["audio"]["type"]; // The type of file it is&#xA;           $fileSize = $_FILES["audio"]["size"]; // File size in bytes&#xA;           $fileErrorMsg = $_FILES["audio"]["error"]; // 0 for false... and 1 for true&#xA;           &#xA;           if (in_array($FILENAME, $animal)) &#xA;           { &#xA;               $sql = "INSERT INTO mdl_media_animal (animal_image_path,animal_name,animal_audio_path) VALUES (&#x27;$image_file_upload&#x27;,&#x27;$FILENAME&#x27;,&#x27;$audio_file_upload&#x27;)";&#xA;           } else {&#xA;               $sql = "INSERT INTO mdl_media_others (others_image_path,others_name,others_audio_path) VALUES (&#x27;$image_file_upload&#x27;,&#x27;$FILENAME&#x27;,&#x27;$audio_file_upload&#x27;)";&#xA;           }&#xA;&#xA;           // if file exists&#xA;           if (file_exists($audio_target_file) || file_exists($image_target_file)) {&#xA;               echo "alert";&#xA;           } else {&#xA;               // write image file&#xA;               if (file_put_contents($image_target_file, $image_data) ) {&#xA;                   // ffmpeg to write audio file&#xA;                   $output = shell_exec("ffmpeg -i $fileTmpLoc -ab 160k -ac 2 -ar 44100 -vn $audio_target_file");&#xA;                   echo $output;&#xA;               &#xA;                   // $stmt = $conn->prepare($sql);&#xA;                   $db = mysqli_connect("localhost", "root", "root", "moodle310"); &#xA;                   // echo $sql;&#xA;                   if (!$db) {&#xA;                       echo "nodb";&#xA;                       die("Connection failed: " . mysqli_connect_error());&#xA;                   }&#xA;                   // echo"sucess";&#xA;                   if(mysqli_query($db, $sql)){&#xA;                   // if($stmt->execute()){&#xA;                       echo $fileTmpLoc;&#xA;                       echo "sucess";  &#xA;                       echo $output;&#xA;                   }&#xA;                   else {&#xA;                       // echo "Error: " . $sql . "<br />" . mysqli_error($conn);&#xA;                       echo "failed";&#xA;                   }&#xA;&#xA;               }else {&#xA;                   echo "failed";&#xA;               }&#xA;&#xA;               &#xA;           &#xA;           &#xA;           }&#xA;   &#xA;    // $test = "ffmpeg -i $outputfile -ab 160k -ac 2 -ar 44100 -vn bub.wav";&#xA;       } else&#xA;       {&#xA;         echo "File size exceeds 5 MB! Please try again!";&#xA;       }&#xA;}&#xA;else&#xA;{&#xA;   echo "PHP! Not a video! ";//.$extension." ".$_FILES["uploadimage"]["type"];&#xA;   }&#xA;&#xA;?>&#xA;

    &#xA;

    I am a student learning frontend but a project of mine requires a fair bit of backend. So forgive me if my question sounds silly.

    &#xA;

    What I meant by manually overriding it was creating another folder and a index.php file with echo "hello"; $output = shell_exec("ffmpeg -i Elephant.mp3 -ab 160k -ac 2 -ar 44100 -vn bub.mp3"); echo $output; so only yes in this case Elephant.mp3 was changed as the initial tmp path so in this case as suggested by Mr.CBroe the permissons shouldn't be an issue.

    &#xA;

    Okay I checked my Apache_error.logonly to find out ffmpeg is indeed the culprit ... I had installed ffmpeg globally so I am not sure if it is an access problem but here is a snippet of the log

    &#xA;

    I checked my php logs and found out that FFmpeg is the culprit.&#xA;Attached is a short log file

    &#xA;

    [Mon May 31 18:11:33 2021] [notice] caught SIGTERM, shutting down&#xA;[Mon May 31 18:11:40 2021] [notice] Digest: generating secret for digest authentication ...&#xA;[Mon May 31 18:11:40 2021] [notice] Digest: done&#xA;[Mon May 31 18:11:40 2021] [notice] Apache/2.2.34 (Unix) mod_ssl/2.2.34 OpenSSL/1.0.2o PHP/7.2.10 configured -- resuming normal operations&#xA;sh: ffmpeg: command not found&#xA;sh: ffmpeg: command not found&#xA;sh: ffmpeg: command not found&#xA;

    &#xA;