Recherche avancée

Médias (1)

Mot : - Tags -/musée

Autres articles (99)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

  • Ecrire une actualité

    21 juin 2013, par

    Présentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
    Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
    Vous pouvez personnaliser le formulaire de création d’une actualité.
    Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)

  • 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

Sur d’autres sites (13193)

  • Saving a continuous stream of images from ffmpeg image2pipe using golang

    11 février 2020, par Mina

    I am trying to save a sequence/continuous images from ffmpeg image2pipe in go. The problem with the code below that it does only save the first image in the stream due to the blocking nature of io.Copy since it waits for the reader or the writer to close.

    package main

    import (
       "fmt"
       "io"
       "log"
       "os"
       "os/exec"
       "strconv"
       "time"
    )

    //Trying to get png from stdout pipe

    func main() {
       fmt.Println("Running the camera stream")
       ffmpegCmd := exec.Command("ffmpeg", "-loglevel", "quiet", "-y", "-rtsp_transport", "tcp", "-i", "rtsp://admin:123456@192.168.1.41:554/h264Preview_01_main", "-r", "1", "-f", "image2pipe", "pipe:1")

       ffmpegOut, err := ffmpegCmd.StdoutPipe()
       if err != nil {
           return
       }

       err = ffmpegCmd.Start()

       if err != nil {
           log.Fatal(err)
       }

       count := 0
       for {
           count++
           t := time.Now()
           fmt.Println("writing image" + strconv.Itoa(count))
           filepath := "image-" + strconv.Itoa(count) + "-" + t.Format("20060102150405.png")

           out, err := os.Create(filepath)
           if err != nil {
               log.Fatal(err)
           }
           defer out.Close()

           _, err = io.Copy(out, ffmpegOut)
           if err != nil {
               log.Fatalf("unable to copy to file: %s", err.Error())
           }
       }
       if err := ffmpegCmd.Wait(); err != nil {
           log.Fatal("Error while waiting:", err)
       }
    }

    I implemented my own save and copy function based on the io.Copy code https://golang.org/src/io/io.go

    func copyAndSave(w io.Writer, r io.Reader) error {
       buf := make([]byte, 1024, 1024)
       for {
           n, err := r.Read(buf[:])
           if n == 0 {

           }
           if n > 0 {
               d := buf[:n]
               _, err := w.Write(d)
               if err != nil {
                   return err
               }
           }
           if err != nil {
               return err
           }

       }
       return nil
    }

    then I updated the for loop in my main function to the below block but still I am only getting the first image in the sequence. due to r.Read(buf[:]) is being a blocking call.

    for {
           count++
           t := time.Now()
           fmt.Println("writing image" + strconv.Itoa(count))
           filepath := "image-" + strconv.Itoa(count) + "-" + t.Format("20060102150405.png")

           out, err := os.Create(filepath)
           if err != nil {
               log.Fatal(err)
           }
           defer out.Close()

           err = copyAndSave(out, ffmpegOut)
           if err != nil {
               if err == io.EOF {
                   break
               }
               log.Fatalf("unable to copy to file: %s", err.Error())
               break
           }
       }

    Any help is appreciated and sorry for in typos in advance :)

  • FFMPEG save last 10 sec before a movement and next 30secs

    2 novembre 2020, par Set1ish

    I have a surveillance camera that process frame by frame live video. In case of movement, I want to save a video containing the last 10 seconds before the movement and next 30 seconds after the movement.
I beleve (may be I'm wrong), that last 10 second + next 30seconds task, should be obtained without decoding-rencoding process.

    


    I try to use python with fmmpeg pipes, creating a reader and a writer, but the reader seams too slow for the stream and I loose some packets (= loose on video quality for saved file).

    


    Here my code

    


    import ffmpeg
import numpy as np

width = 1280
height = 720


process1 = (
    ffmpeg
    .input('rtsp://.....',rtsp_transport='udp', r='10', t="00:00:30")
    .output('pipe:', format='rawvideo', pix_fmt='yuv420p')
    .run_async(pipe_stdout=True)
)

process2 = (
    ffmpeg
    .input('pipe:', format='rawvideo', pix_fmt='yuv420p', s='{}x{}'.format(width, height))
    .output("prova-02-11-2020.avi", pix_fmt='yuv420p',r='10')
    .overwrite_output()
    .run_async(pipe_stdin=True)
)
while True:
    in_bytes = process1.stdout.read(width * height * 3)
    if not in_bytes:
        break
    in_frame = (
        np
        .frombuffer(in_bytes, np.uint8)
        )

    #In future I will save in_frame in a queue
    out_frame = in_frame
   
    process2.stdin.write(
        out_frame
        .astype(np.uint8)
        .tobytes()
    )

process2.stdin.close()
process1.wait()
process2.wait()


    


    If I run

    


    ffmpeg -i rtsp://... -acodec copy -vcodec copy -t "00:00:30" out.avi


    


    It look that decode-rencode process is done in quick/smart way without loosing any packet.
My dream is to make the same on python for the surveillance camera but intergrating with code that analyse the stream.

    


    I would like that the flow for creating the file, does not requires decoding + enconding. The last 10secs frames are in a queue and, at specific event, the contenet of queue plus next 30secs frames are saved into a avi file

    


    I have the constraints to have realtime motion detection on live streaming

    


    Did you have any comments or suggestion ?

    


  • avcodec/vp9 : add a never triggerable assert.

    16 novembre 2013, par Clément Bœsch
    avcodec/vp9 : add a never triggerable assert.
    

    vp8_rac_get_tree() is called with a tree of size 3, so the returned
    value can not be outside [0 ;3]. All of the [0 ;3] cases are handled in
    the switch, so the assert should not be triggerable by any means. A
    similar change was introduced in 97962b2 / 72ca830, with the
    av_log()+AVERROR_INVALIDDATA form, suggesting it could be triggerable
    somehow. This assert might help static analyzer, or simply the reader.

    • [DH] libavcodec/vp9.c