Recherche avancée

Médias (1)

Mot : - Tags -/Rennes

Autres articles (50)

  • Librairies et logiciels spécifiques aux médias

    10 décembre 2010, par

    Pour un fonctionnement correct et optimal, plusieurs choses sont à prendre en considération.
    Il est important, après avoir installé apache2, mysql et php5, d’installer d’autres logiciels nécessaires dont les installations sont décrites dans les liens afférants. Un ensemble de librairies multimedias (x264, libtheora, libvpx) utilisées pour l’encodage et le décodage des vidéos et sons afin de supporter le plus grand nombre de fichiers possibles. Cf. : ce tutoriel ; FFMpeg avec le maximum de décodeurs et (...)

  • Les autorisations surchargées par les plugins

    27 avril 2010, par

    Mediaspip core
    autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs

  • Encoding and processing into web-friendly formats

    13 avril 2011, par

    MediaSPIP automatically converts uploaded files to internet-compatible formats.
    Video files are encoded in MP4, Ogv and WebM (supported by HTML5) and MP4 (supported by Flash).
    Audio files are encoded in MP3 and Ogg (supported by HTML5) and MP3 (supported by Flash).
    Where possible, text is analyzed in order to retrieve the data needed for search engine detection, and then exported as a series of image files.
    All uploaded files are stored online in their original format, so you can (...)

Sur d’autres sites (7528)

  • Problems piping ffmpeg to flac encoder

    19 mai 2019, par Sebastian Olsen

    I need to encode a flac file with seektables, ffmpeg’s flac encoder does not include seektables, so I need to use the flac CLI. I’m trying to make it possible to convert any arbitrary audio file to a seekable flac file by first piping it through ffmpeg, then to the flac encoder.

    export const transcodeToFlac: AudioTranscoder<{}> = ({
     source,
     destination
    }) => {
     return new Promise((resolve, reject) => {
       let totalSize = 0

       const { stdout: ffmpegOutput, stderr: ffmpegError } = spawn("ffmpeg", [
         "-i",
         source,
         "-f",
         "wav",
         "pipe:1"
       ])

       const { stdout: flacOutput, stdin: flacInput, stderr: flacError } = spawn(
         "flac",
         ["-"]
       )

       flacOutput.on("data", (buffer: Buffer) => {
         totalSize += buffer.byteLength
       })

       ffmpegError.on("data", error => {
         console.log(error.toString())
       })

       flacError.on("data", error => {
         console.log(error.toString())
       })

       //stream.on("error", reject)

       destination.on("finish", () => {
         resolve({
           mime: "audio/flac",
           size: totalSize,
           codec: "flac",
           bitdepth: 16,
           ext: "flac"
         })
       })

       ffmpegOutput.pipe(flacInput)
       flacOutput.pipe(destination)
     })
    }

    While this code works, the resulting flac file is not correct. The source audio is of duration 06:14, but the flac file is of duration 06:45:47. Encoding the flac manually without piping ffmpeg to it works fine, but I cannot do that in a server environment where I need to utilize streams.

    Here’s what the flac encoder outputs when transcoding :

    flac 1.3.2
    Copyright (C) 2000-2009  Josh Coalson, 2011-2016  Xiph.Org Foundation
    flac comes with ABSOLUTELY NO WARRANTY.  This is free software, and you are
    welcome to redistribute it under certain conditions.  Type `flac' for details.

    -: WARNING: skipping unknown chunk 'LIST' (use --keep-foreign-metadata to keep)
    -: WARNING, cannot write back seekpoints when encoding to stdout
    -: 0% complete, ratio=0.357
    0% complete, ratio=0.432
    0% complete, ratio=0.482
    0% complete, ratio=0.527
    0% complete, ratio=0.541
    1% complete, ratio=0.554
    1% complete, ratio=0.563
    1% complete, ratio=0.571
    size=   36297kB time=00:03:30.70 bitrate=1411.2kbits/s speed= 421x
    1% complete, ratio=0.572
    1% complete, ratio=0.570
    1% complete, ratio=0.577
    1% complete, ratio=0.583
    1% complete, ratio=0.584
    1% complete, ratio=0.590
    1% complete, ratio=0.592
    size=   64512kB time=00:06:14.49 bitrate=1411.2kbits/s speed= 421x
    video:0kB audio:64512kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead:
    0.000185%

    -: WARNING: unexpected EOF; expected 1073741823 samples, got 16510976 samples
    2% complete, ratio=0.579
  • PyAV : force new framerate while remuxing stream ?

    7 juin 2019, par ToxicFrog

    I have a Python program that receives a sequence of H264 video frames over the network, which I want to display and, optionally, record. The camera records at 30FPS and sends frames as fast as it can, which isn’t consistently 30FPS due to changing network conditions ; sometimes it falls behind and then catches up, and rarely it drops frames entirely.

    The "display" part is easy ; I don’t need to care about timing or stream metadata, just display the frames as fast as they arrive :

    input = av.open(get_video_stream())
    for packet in input.demux(video=0):
     for frame in packet.decode():
       # A bunch of numpy and pygame code here to convert the frame to RGB
       # row-major and blit it to the screen

    The "record" part looks like it should be easy :

    input = av.open(get_video_stream())
    output = av.open(filename, 'w')
    output.add_stream(template=input.streams[0])
    for packet in input.demux(video=0):
     for frame in packet.decode():
       # ...display code...
     packet.stream = output.streams[0]
     output.mux_one(packet)
    output.close()

    And indeed this produces a valid MP4 file containing all the frames, and if I play it back with mplayer -fps 30 it works fine. But that -fps 30 is absolutely required :

    $ ffprobe output.mp4
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 960x720,
                     1277664 kb/s, 12800 fps, 12800 tbr, 12800 tbn, 25600 tbc (default)

    Note that 12,800 frames/second. It should look something like this (produced by calling mencoder -fps 30 and piping the frames into it) :

    $ ffprobe mencoder_test.mp4
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 960x720,
                     2998 kb/s, 30 fps, 30 tbr, 90k tbn, 180k tbc (default)

    Inspecting the packets and frames I get from the input stream, I see :

    stream: time_base=1/1200000
    codec: framerate=25 time_base=1/50
    packet: dts=None pts=None duration=48000 time_base=1/1200000
    frame: dst=None pts=None time=None time_base=1/1200000

    So, the packets and frames don’t have timestamps at all ; they have a time_base which doesn’t match either the timebase that ends up in the final file or the actual framerate of the camera ; the codec has a framrate and timebase that doesn’t match the final file, the camera framerate, or the other video stream metadata !

    The PyAV documentation is all but entirely absent when it comes to issues of timing and framerate, but I have tried manually setting various combinations of stream, packet, and frame time_base, dts, and pts with no success. I can always remux the recorded videos again to get the correct framerate, but I’d rather write video files that are correct in the first place.

    So, how do I get pyAV to remux the video in a way that produces an output that is correctly marked as 30fps ?

  • cbs_h264, h264_metadata : Deleting SEI messages never fails

    8 juillet 2019, par Andreas Rheinhardt
    cbs_h264, h264_metadata : Deleting SEI messages never fails
    

    Given the recent changes to ff_cbs_delete_unit, it is no longer sensible
    to use a return value for ff_cbs_h264_delete_sei_message ; instead, use
    asserts to ensure that the required conditions are met and remove the
    callers' checks for the return value. Also, document said conditions.

    An assert that is essentially equivalent to the one used in
    ff_cbs_delete_unit has been removed, too.

    Signed-off-by : Andreas Rheinhardt <andreas.rheinhardt@gmail.com>

    • [DH] libavcodec/cbs_h264.h
    • [DH] libavcodec/cbs_h2645.c
    • [DH] libavcodec/h264_metadata_bsf.c