Recherche avancée

Médias (1)

Mot : - Tags -/censure

Autres articles (67)

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

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

  • Possibilité de déploiement en ferme

    12 avril 2011, par

    MediaSPIP peut être installé comme une ferme, avec un seul "noyau" hébergé sur un serveur dédié et utilisé par une multitude de sites différents.
    Cela permet, par exemple : de pouvoir partager les frais de mise en œuvre entre plusieurs projets / individus ; de pouvoir déployer rapidement une multitude de sites uniques ; d’éviter d’avoir à mettre l’ensemble des créations dans un fourre-tout numérique comme c’est le cas pour les grandes plate-formes tout public disséminées sur le (...)

Sur d’autres sites (6612)

  • Image generated by System.Drawing.Image is 10x larger than original file

    13 mai 2021, par Ninbura

    I've written a Powershell script that extracts one frame from a dshow capture device using FFmpeg, and then copies the output image from a file to my clipboard :

    


    $screenshot = [System.Drawing.Image]::FromFile((Get-Item -Path $outputFilePath))
[System.Windows.Forms.Clipboard]::SetImage($screenshot)
$screenshot.Dispose()


    


    The original file is a 1MB JPEG, but the image in my clipboard is an 11MB PNG. When I go to paste this file into something like Discord the file size is too large, unless you have Discord Nitro.

    


    Is there any way to avoid this file size inflation while using [System.Drawing.Image]::FromFile() ?

    


    Here's an easy test template :

    


    Add-Type -AssemblyName System.Drawing
Add-Type -AssemblyName System.Windows.Forms

$screenshot = [System.Drawing.Image]::FromFile((Get-Item -Path "Path to picture"))
[System.Windows.Forms.Clipboard]::SetImage($screenshot)
$screenshot.Dispose()


    


    Edit 2021/05/13 :

    


    Interestingly, it's starting to seem like this is a limitation of copying an image to a clipboard. I decided to dig deeper and see if the image size was increasing when I drew the image with System.Drawing.Image or when I pushed it in my clipboard with System.Windwos.Forms.Clipboard. If I save the image before putting it my clipboard like so, it retains the original file size, even if I change the extension to png :

    


    Add-Type -AssemblyName System.Drawing
Add-Type -AssemblyName System.Windows.Forms

$screenshot = [System.Drawing.Image]::FromFile((Get-Item -Path "C:\Users\gabri\Pictures\FFScreenshots\2021-05-12 19-04-26.845.jpeg"))
$screenshot.Save("C:\Users\gabri\Pictures\FFScreenshots\test.jpeg") # test.png makes no difference
$screenshot.Dispose()


    


    So it would seem that the image grows exponentially in size specifically when I push it to my clipboard. I verified this by simply uploading an image to Discord, copying it to my clipboard (click image > Open original > right click and copy result), and uploading it again. Sure enough, the new image pasted from my clipboard was around 10x the size of the original image (1MB vs 12MB). I wondered if this was a "limitation" of Windows so I ran the same test on Ubuntu 20.04. Uploaded an image to Discord, copied the image to my clipboard, and uploaded it again. Once again the image was about 10x larger, though slightly smaller than then when I uploaded the image from my clipboard on my Windows machine (11.4MB VS 12MB). Just to make sure this wasn't limited to Discord, I ran the same test with Gmail in-browser on both operating systems, same result.

    


    Alas, there appears to be something happening when you copy an image to a clipboard that drastically increases file size. One thing's for sure, whatever's happening is definitely over my head.

    


  • ffmpeg options to stream to Youtube

    24 octobre 2022, par David Goncalves

    Please bear with me as I don't really understand most of the commands behind ffmpeg.

    


    I am using this code to live stream from a raspberry 4B with a USB Logitech C920 to YouTube :
ffmpeg -re -f s16le -i /dev/zero -f v4l2 -thread_queue_size 512 -codec:v h264 -s 1920x1080 -i /dev/video0 -codec:v copy -acodec aac -b:v 128k -g 60 -f flv rtmp ://a.rtmp.youtube.com/live2/[key]

    


    The streaming works but I get the following error in the command line :
Non-monotonous DTS in output stream 0:0 ; previous : 0, current : -167 ; changing to 0. This may result in incorrect timestamps in the output file.

    


    I also get this error in Youtube studio :
Please use a keyframe frequency of four seconds or less. Currently, keyframes are not being sent often enough, which can cause buffering. The current keyframe frequency is 8.0 seconds. Note that ingestion errors can cause incorrect GOP (group of pictures) sizes.
Any help ?

    


  • PHP - Read and write the same file hangs

    2 février 2016, par Adracat

    I’m trying to use FFMPEG to make some works with video on the server, and something I need to do is to get the progress of the process.

    I searched a little and I found this solution which tells to write the log into a file and then reading and parsing it.

    The problem

    What is driving me crazy is that I tell FFMPEG - with exec - (process A) to write the log into a file, but when I try to read it - with file_get_contents() - (process B) it does not show the contents until process A is finished (or interrupted the PHP script).

    So, when process A finishes or it says "PHP script timeout", then I can read the file as times as I want, refreshing the page (process B) and showing the contents at the time.

    What I’ve tried

    I’ve tried to use fopen() to create the file with w, w+ and a parameters, using - and without using - fclose(). I’ve tried to use also flock() just in case it gets faster to read to process B if it knows it’s already locked and does not have to wait, but then FFMPEG is not able to write into the file.

    I’ve searched for multithreading too, but I think there must be an easier and simpler way.

    I’ve used also CURL and HTTP context, as this link suggests, but no luck.

    I’ve tried, too, to use PHP-FFMPEG but it’s not supporting the last FFMPEG version, so I cannot use it.

    When I said before "(or interrupted the PHP script)" is because I tried to wait and, when PHP got a timeout, process B worked alright and the file was still updating.

    The code

    Process A (fileA.php)

    exec('ffmpeg -y -i input_file.mp4 output_file.avi 2> C:\Full\Path\To\File\log.txt 1>&2');

    Process B (fileB.php)

    $content = file_get_contents($file);

    if($content){
       //get duration of source
       preg_match("/Duration: (.*?), start:/", $content, $matches);

       $rawDuration = $matches[1];

       //rawDuration is in 00:00:00.00 format. This converts it to seconds.
       $ar = array_reverse(explode(":", $rawDuration));
       $duration = floatval($ar[0]);
       if (!empty($ar[1])) $duration += intval($ar[1]) * 60;
       if (!empty($ar[2])) $duration += intval($ar[2]) * 60 * 60;

       //get the time in the file that is already encoded
       preg_match_all("/time=(.*?) bitrate/", $content, $matches);

       $rawTime = array_pop($matches);

       //this is needed if there is more than one match
       if (is_array($rawTime)){$rawTime = array_pop($rawTime);}

       //rawTime is in 00:00:00.00 format. This converts it to seconds.
       $ar = array_reverse(explode(":", $rawTime));
       $time = floatval($ar[0]);
       if (!empty($ar[1])) $time += intval($ar[1]) * 60;
       if (!empty($ar[2])) $time += intval($ar[2]) * 60 * 60;

       //calculate the progress
       $progress = round(($time/$duration) * 100);

       echo "Duration: " . $duration . "<br />";
       echo "Current Time: " . $time . "<br />";
       echo "Progress: " . $progress . "%";

    }

    The process

    I just open fileA.php on a Chrome tab and, after a few seconds, I open fileB.php on another Chrome tab (and it stays as loading).

    What I need

    I need to be able to load the file and show the information I want to show while the file is being written (by exec and FFMPEG or other PHP scripts), so I can update the progress percentage with some AJAX calls.

    Extra information

    At this point, I’m using PHP 5.4 on a IIS 7.5 with Windows 7 Professional.

    Thank you everyone for your time, help and patience !

    Best regards.