Recherche avancée

Médias (1)

Mot : - Tags -/book

Autres articles (51)

  • Demande de création d’un canal

    12 mars 2010, par

    En fonction de la configuration de la plateforme, l’utilisateur peu avoir à sa disposition deux méthodes différentes de demande de création de canal. La première est au moment de son inscription, la seconde, après son inscription en remplissant un formulaire de demande.
    Les deux manières demandent les mêmes choses fonctionnent à peu près de la même manière, le futur utilisateur doit remplir une série de champ de formulaire permettant tout d’abord aux administrateurs d’avoir des informations quant à (...)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

  • Taille des images et des logos définissables

    9 février 2011, par

    Dans beaucoup d’endroits du site, logos et images sont redimensionnées pour correspondre aux emplacements définis par les thèmes. L’ensemble des ces tailles pouvant changer d’un thème à un autre peuvent être définies directement dans le thème et éviter ainsi à l’utilisateur de devoir les configurer manuellement après avoir changé l’apparence de son site.
    Ces tailles d’images sont également disponibles dans la configuration spécifique de MediaSPIP Core. La taille maximale du logo du site en pixels, on permet (...)

Sur d’autres sites (8418)

  • Node.js, stream pipe output data to client with socket io-stream

    22 mai 2018, par Empha

    Sorry for a repeating topic, but i’ve searched and experimented for 2 days now and i haven’t been able to solve the problem.

    I am trying to live stream pictures every 1 second to a client via socket.io-stream using the following code :

    var args = [
       "-i",
       "/dev/video0",
       "-s",
       "1280x720",
       "-qscale",
       1,
       "-vf",
       "fps=1",
       config.imagePath,
       "-s",
       config.imageStream.resolution[0],
       "-f",
       "image2pipe",
       "-qscale",
       1,
       "-vf",
       "fps=1",
       "pipe:1"
    ];
    camera = spawn("avconv", args);    // avconv = ffmpeg

    The settings are good, and the process writes to stdout successfully. I capture all outgoing image data using this simplified code :

    var ss = require("socket.io-stream");
    camera.stdout.on("data", function(data) {
       var stream = ss.createStream();
       ss(socket).emit("img", stream, "newImg");
       // how do i write the data-object to the stream?
       // fs.createReadStream(imagePath).pipe(stream);
    });

    "socket" comes from the client using the socket.io-package, no problem there. So what i am doing is that i listen to the stdout-pipe for the "data" event. That data gets passed to the function above. That means that at this stage "data" is not a stream, its a "<buffer></buffer>code>"-object, and therefore i cannot stream it like i could previously using the commented createReadStream-statement where i read the image from disk. <strong>How do i stream the data (Buffer at this stage) to the client? Can i do this differently, perhaps not using socket.io-stream?</strong> "data" is just one part of the whole image, so perhaps two or three "data"-objects need to be put together to form the complete image.

    I tried using "stream.write(data, "binary") ;" which did transfer the Buffer-objects, problem is that there is not end of stream-event and therefore i do not know when an image is complete. I tried registering to stdout.on "close", "end", "finish", nothing triggers. Am i missing something ? Am i making it overly complex ? The reasoning behind my implementation is that i need a new stream for each complete image, is that right ?

    Thanks alot !

  • Use C# to converting apng to webm with ffmpeg from pipe input and output

    30 novembre 2022, par martin wang

    I was using ffmpeg to convert Line sticker from apng file to webm file.&#xA;And the result is weird, some of them was converted successed and some of them failed.&#xA;not sure what happend with these failed convert.

    &#xA;

    Here is my c# code to convert Line sticker to webm,&#xA;and I use CliWrap to run ffmpeg command line.

    &#xA;

    async Task Main()&#xA;{&#xA;&#xA;    var downloadUrl = @"http://dl.stickershop.LINE.naver.jp/products/0/0/1/23303/iphone/stickerpack@2x.zip";&#xA;    var arg = @$"-i pipe:.png -vf scale=512:512:force_original_aspect_ratio=decrease:flags=lanczos -pix_fmt yuva420p -c:v libvpx-vp9 -cpu-used 5 -minrate 50k -b:v 350k -maxrate 450k -to 00:00:02.900 -an -y -f webm pipe:1";&#xA;&#xA;    var errorCount = 0;&#xA;    try&#xA;    {&#xA;        using (var hc = new HttpClient())&#xA;        {&#xA;            var imgsZip = await hc.GetStreamAsync(downloadUrl);&#xA;&#xA;            using (ZipArchive zipFile = new ZipArchive(imgsZip))&#xA;            {&#xA;                var files = zipFile.Entries.Where(entry => Regex.IsMatch(entry.FullName, @"animation@2x\/\d&#x2B;\@2x.png"));&#xA;                foreach (var entry in files)&#xA;                {&#xA;                    try&#xA;                    {&#xA;                        using (var fileStream = File.Create(Path.Combine("D:", "Projects", "ffmpeg", "Temp", $"{Path.GetFileNameWithoutExtension(entry.Name)}.webm")))&#xA;                        using (var pngFileStream = File.Create(Path.Combine("D:", "Projects", "ffmpeg", "Temp", $"{entry.Name}")))&#xA;                        using (var entryStream = entry.Open())&#xA;                        using (MemoryStream ms = new MemoryStream())&#xA;                        {&#xA;                            entry.Open().CopyTo(pngFileStream);&#xA;&#xA;                            var result = await Cli.Wrap("ffmpeg")&#xA;                                         .WithArguments(arg)&#xA;                                         .WithStandardInputPipe(PipeSource.FromStream(entryStream))&#xA;                                         .WithStandardOutputPipe(PipeTarget.ToStream(ms))&#xA;                                         .WithStandardErrorPipe(PipeTarget.ToFile(Path.Combine("D:", "Projects", "ffmpeg", "Temp", $"{Path.GetFileNameWithoutExtension(entry.Name)}Info.txt")))&#xA;                                         .WithValidation(CommandResultValidation.ZeroExitCode)&#xA;                                         .ExecuteAsync();&#xA;                            ms.Seek(0, SeekOrigin.Begin);&#xA;                            ms.WriteTo(fileStream);&#xA;                        }&#xA;                    }&#xA;                    catch (Exception ex)&#xA;                    {&#xA;                        entry.FullName.Dump();&#xA;                        ex.Dump();&#xA;                        errorCount&#x2B;&#x2B;;&#xA;                    }&#xA;                }&#xA;            }&#xA;&#xA;        }&#xA;    }&#xA;    catch (Exception ex)&#xA;    {&#xA;        ex.Dump();&#xA;    }&#xA;    $"Error Count:{errorCount.Dump()}".Dump();&#xA;&#xA;}&#xA;

    &#xA;

    This is the failed convert file's error information from ffmpeg :

    &#xA;

    enter image description here

    &#xA;

    And the successed convert file from ffmpeg infromation :&#xA;enter image description here

    &#xA;

    It's strange when I was manually converted these failed convert file from command line, and it will be converted successed.&#xA;enter image description here

    &#xA;

    The question is the resource of images are all the same apng file,&#xA;so I just can't understan why some of files will convert failed from my c# code&#xA;but also when I manually use command line will be converted successed ?

    &#xA;


    &#xA;

    I have written same exampe from C# to Python...&#xA;and here is python code :

    &#xA;

    from io import BytesIO&#xA;import os&#xA;import re&#xA;import subprocess&#xA;import zipfile&#xA;&#xA;import requests&#xA;&#xA;&#xA;downloadUrl = "http://dl.stickershop.LINE.naver.jp/products/0/0/1/23303/iphone/stickerpack@2x.zip"&#xA;args = [&#xA;    &#x27;ffmpeg&#x27;,&#xA;    &#x27;-i&#x27;, &#x27;pipe:&#x27;,&#xA;    &#x27;-vf&#x27;, &#x27;scale=512:512:force_original_aspect_ratio=decrease:flags=lanczos&#x27;,&#xA;    &#x27;-pix_fmt&#x27;, &#x27;yuva420p&#x27;,&#xA;    &#x27;-c:v&#x27;, &#x27;libvpx-vp9&#x27;,&#xA;    &#x27;-cpu-used&#x27;, &#x27;5&#x27;,&#xA;    &#x27;-minrate&#x27;, &#x27;50k&#x27;,&#xA;    &#x27;-b:v&#x27;, &#x27;350k&#x27;,&#xA;    &#x27;-maxrate&#x27;, &#x27;450k&#x27;, &#x27;-to&#x27;, &#x27;00:00:02.900&#x27;, &#x27;-an&#x27;, &#x27;-y&#x27;, &#x27;-f&#x27;, &#x27;webm&#x27;, &#x27;pipe:1&#x27;&#xA;]&#xA;&#xA;&#xA;imgsZip = requests.get(downloadUrl)&#xA;with zipfile.ZipFile(BytesIO(imgsZip.content)) as archive:&#xA;    files = [file for file in archive.infolist() if re.match(&#xA;        "animation@2x\/\d&#x2B;\@2x.png", file.filename)]&#xA;    for entry in files:&#xA;        fileName = entry.filename.replace(&#xA;            "animation@2x/", "").replace(".png", "")&#xA;        rootPath = &#x27;D:\\&#x27; &#x2B; os.path.join("Projects", "ffmpeg", "Temp")&#xA;        # original file&#xA;        apngFile = os.path.join(rootPath, fileName&#x2B;&#x27;.png&#x27;)&#xA;        # output file&#xA;        webmFile = os.path.join(rootPath, fileName&#x2B;&#x27;.webm&#x27;)&#xA;        # output info&#xA;        infoFile = os.path.join(rootPath, fileName&#x2B;&#x27;info.txt&#x27;)&#xA;&#xA;        with archive.open(entry) as file, open(apngFile, &#x27;wb&#x27;) as output_apng, open(webmFile, &#x27;wb&#x27;) as output_webm, open(infoFile, &#x27;wb&#x27;) as output_info:&#xA;            p = subprocess.Popen(args, stdin=subprocess.PIPE,&#xA;                                 stdout=subprocess.PIPE, stderr=output_info)&#xA;            outputBytes = p.communicate(input=file.read())[0]&#xA;&#xA;            output_webm.write(outputBytes)&#xA;            file.seek(0)&#xA;            output_apng.write(file.read())&#xA;&#xA;

    &#xA;

    And you can try it,the result will be the as same as C#.

    &#xA;

  • How to pipe frames in stdout using FFMPEG and Golang

    6 avril 2020, par Sven.DG

    I am fairly new to Golang, my goal is to build a script in Golang that :

    &#xA;&#xA;

      &#xA;
    1. Transcodes the video input .MOV file into frames, using FFMPEG
    2. &#xA;

    3. Some downstream process that does something with the emitted frames.
    4. &#xA;

    &#xA;&#xA;

    Currently I have the following code as a first attempt :

    &#xA;&#xA;

    package main&#xA;&#xA;import (&#xA;    "fmt"&#xA;    "os/exec"&#xA;    "strconv"&#xA;    "io"&#xA;)&#xA;&#xA;const (&#xA;    frameX      = 240&#xA;    frameY      = 135&#xA;    frameSize   = frameX * frameY * 3&#xA;)&#xA;&#xA;func main() {&#xA;    ffmpeg := exec.Command("ffmpeg", "-i", "project/data/sample.mov", "-vf",  "fps=fps=1/2", "-s", strconv.Itoa(frameX)&#x2B;"x"&#x2B;strconv.Itoa(frameY), "-f", "rawvideo", "pipe:1") //nolint&#xA;    ffmpegOut, _ := ffmpeg.StdoutPipe()&#xA;&#xA;    if err := ffmpeg.Start(); err != nil {&#xA;        panic(err)&#xA;    }&#xA;&#xA;    reader(ffmpegOut)&#xA;    fmt.Println("Completed. YAY")&#xA;}&#xA;&#xA;func reader(ffmpegOut io.Reader) {&#xA;    buf := make([]byte, frameSize)&#xA;    fmt.Println("Looping..")&#xA;    counter := 0&#xA;    for {&#xA;        if _, err := io.ReadFull(ffmpegOut, buf); err != nil {&#xA;            // fmt.Println(err)&#xA;        }&#xA;        if buf[0] != 0 {&#xA;            fmt.Println("Got a frame!!")&#xA;            counter&#x2B;&#x2B;&#xA;            fmt.Println(counter)&#xA;        }&#xA;    }&#xA;    fmt.Println("total amount of frames", counter)&#xA;}&#xA;

    &#xA;&#xA;

    This is mainly based on this example : https://github.com/pion/example-webrtc-applications/blob/master/gocv-receive/main.go

    &#xA;&#xA;

    However, when running this code, it appears that I'm getting an endless amount of data in my downstream reader. I would expect that the counter equals the amount of frames but that is clearly not the case looking at the rate at which the counter increases, so obviously I am doing something wrong. Can anybody point me in the right direction ?

    &#xA;&#xA;

    I used the sample .mov file with 1280 x 720 resolution here : https://file-examples.com/index.php/sample-video-files/sample-mov-files-download/.&#xA;The video is about 31 seconds so I would expect to see 15 frames downstream in the reader.

    &#xA;&#xA;

    Cheers !

    &#xA;