Recherche avancée

Médias (2)

Mot : - Tags -/media

Autres articles (45)

  • 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

  • MediaSPIP Init et Diogène : types de publications de MediaSPIP

    11 novembre 2010, par

    À l’installation d’un site MediaSPIP, le plugin MediaSPIP Init réalise certaines opérations dont la principale consiste à créer quatre rubriques principales dans le site et de créer cinq templates de formulaire pour Diogène.
    Ces quatre rubriques principales (aussi appelées secteurs) sont : Medias ; Sites ; Editos ; Actualités ;
    Pour chacune de ces rubriques est créé un template de formulaire spécifique éponyme. Pour la rubrique "Medias" un second template "catégorie" est créé permettant d’ajouter (...)

  • Les formats acceptés

    28 janvier 2010, par

    Les commandes suivantes permettent d’avoir des informations sur les formats et codecs gérés par l’installation local de ffmpeg :
    ffmpeg -codecs ffmpeg -formats
    Les format videos acceptés en entrée
    Cette liste est non exhaustive, elle met en exergue les principaux formats utilisés : h264 : H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 m4v : raw MPEG-4 video format flv : Flash Video (FLV) / Sorenson Spark / Sorenson H.263 Theora wmv :
    Les formats vidéos de sortie possibles
    Dans un premier temps on (...)

Sur d’autres sites (6483)

  • Python asyncio subprocess code returns "pipe closed by peer or os.write(pipe, data) raised exception."

    4 novembre 2022, par Duke Dougal

    I am trying to convert a synchronous Python process to asyncio. Any ideas what I am doing wrong ?

    


    This is the synchronous code which successfully starts ffmpeg and converts a directory of webp files into a video.

    


    import subprocess
import shlex
from os import listdir
from os.path import isfile, join

output_filename = 'output.mp4'
process = subprocess.Popen(shlex.split(f'ffmpeg -y -framerate 60 -i pipe: -vcodec libx265 -pix_fmt yuv420p -crf 24 output.mp4'), stdin=subprocess.PIPE)

thepath = '/home/ubuntu/webpfiles/'
thefiles = [f for f in listdir(thepath) if isfile(join(thepath, f))]
for filename in thefiles:
    absolute_path = f'{thepath}{filename}'
    with open(absolute_path, 'rb') as f:
        process.stdin.write(f.read())

process.stdin.close()
process.wait()
process.terminate()


    


    This async code fails :

    


    from os import listdir
from os.path import isfile, join
import shlex
import asyncio

outputfilename = 'output.mp4'

async def write_stdin(proc):
    thepath = '/home/ubuntu/webpfiles/'
    thefiles = [f for f in listdir(thepath) if isfile(join(thepath, f))]
    thefiles.sort()
    for filename in thefiles:
        absolute_path = f'{thepath}{filename}'
        with open(absolute_path, 'rb') as f:
            await proc.communicate(input=f.read())

async def create_ffmpeg_subprocess():
    bin = f'/home/ubuntu/bin/ffmpeg'
    params = f'-y -framerate 60 -i pipe: -vcodec libx265 -pix_fmt yuv420p -crf 24 {outputfilename}'
    proc = await asyncio.create_subprocess_exec(
        bin,
        *shlex.split(params),
        stdin=asyncio.subprocess.PIPE,
        stdout=asyncio.subprocess.PIPE,
        stderr=asyncio.subprocess.PIPE,
    )
    return proc

async def start():
    loop = asyncio.get_event_loop()
    proc = await create_ffmpeg_subprocess()
    task_stdout = loop.create_task(write_stdin(proc))
    await asyncio.gather(task_stdout)

if __name__ == '__main__':
    asyncio.run(start())


    


    The output for the async code is :

    


    pipe closed by peer or os.write(pipe, data) raised exception.
pipe closed by peer or os.write(pipe, data) raised exception.
pipe closed by peer or os.write(pipe, data) raised exception.
pipe closed by peer or os.write(pipe, data) raised exception.
pipe closed by peer or os.write(pipe, data) raised exception.
pipe closed by peer or os.write(pipe, data) raised exception.
pipe closed by peer or os.write(pipe, data) raised exception.
pipe closed by peer or os.write(pipe, data) raised exception.
pipe closed by peer or os.write(pipe, data) raised exception.
pipe closed by peer or os.write(pipe, data) raised exception.
pipe closed by peer or os.write(pipe, data) raised exception.
pipe closed by peer or os.write(pipe, data) raised exception.
pipe closed by peer or os.write(pipe, data) raised exception.
pipe closed by peer or os.write(pipe, data) raised exception.
pipe closed by peer or os.write(pipe, data) raised exception.
pipe closed by peer or os.write(pipe, data) raised exception.


    


    etc - one line for each webp file

    


  • FireFox Video throws warning but video actually works ?

    21 février 2021, par SdBill
      

    • OS : Ubuntu 18.04
    • 


    • FF : 85.0.1
    • 


    • Error/warning : Cannot play media. No decoders for requested formats : video/mp4, video/mp4
    • 


    


    Same error for video/ogg

    


    Here are my questions : 1) The video still plays fine once loaded, and there is no error in Chrome or Chromium. Why does the video work fine after loading but throws the error on load ? 2) Is there anything that can be done without re-encoding over 2 gigs of video ?

    


    Context : this is an old no-profit site that used Flash for video and we really don't want to throw a lot of time at, but there are gigs of videos. I converted all .flv files and .mpg files to .mp4 using the most simple of ffmpeg commands, examples :

    


    ffmpeg -i video-source.flv video-source.mp4
ffmpeg -i video-source.mpg video-source.mp4
ffmpeg -i video-source.mpg video-source.ogg


    


    As I watched the ffmpeg output, it looked to me like the codec was H264 (at least, I think that is what I am seeing, not a video expert.)

    


    Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> theora (libtheora))
  Stream #0:1 -> #0:1 (aac (native) -> vorbis (libvorbis))


    


    Server response in a direct request to the mp4 files is

    


    Content-Type
    video/mp4


    


    I have seen the documentation and posts on fragmented mp4 and if re-encoding is the only option, we're probably going to abandon as it does play once loaded.

    


    Code is simplistic, using an html5 doctype :

    


      <video width="320" height="240" controls="controls">&#xA;   <source src="/images/video/mp4/video-source.mp4" type="video/mp4">&#xA;   <source src="/images/video/ogg/video-source.ogg" type="video/ogg">&#xA;   Your browser does not support the video tag.&#xA;  </source></source></video>&#xA;

    &#xA;

    Is the only option here to pander to FireFox and re-encode everything since as mentioned, it plays fine once loaded and throws no error in Chrome ?

    &#xA;

  • Generating DASH manifest with ffmpeg works in Docker exec shell but not in os.exec golang

    22 février 2023, par Inquisitor

    I am trying to generate a DASH manifest with ffmpeg using this command

    &#xA;

    /usr/bin/ffmpeg -f webm_dash_manifest -i ./480.webm -f webm_dash_manifest -i ./audio.webm -c copy -map 0:0 -map 1:0 -y -f webm_dash_manifest -adaptation_sets "id=0,streams=0 id=1,streams=1" ./manifest.mpd -loglevel repeat&#x2B;level&#x2B;verbose&#xA;

    &#xA;

    I run this in go, in a docker container as shown :

    &#xA;

    func runFFmpeg(arguments []string) {&#xA;    arguments = append(arguments, "-loglevel", "repeat&#x2B;level&#x2B;verbose")&#xA;    cmd := exec.Command("ffmpeg", arguments...)&#xA;&#xA;    fmt.Printf("cmd: %v\n", cmd)&#xA;&#xA;    var out bytes.Buffer&#xA;    var stderr bytes.Buffer&#xA;    cmd.Stdout = &amp;out&#xA;    cmd.Stderr = &amp;stderr&#xA;    err := cmd.Run()&#xA;&#xA;    if err != nil {&#xA;        log.Println(err)&#xA;        log.Println(stderr.String())&#xA;    }&#xA;}&#xA;runFFmpeg([]string{"-f", "webm_dash_manifest", "-i", "./480.webm", "-f", "webm_dash_manifest", "-i", "./audio.webm", "-c", "copy", "-map", "0:0", "-map", "1:0", "-y", "-f", "webm_dash_manifest", "-adaptation_sets", "\"id=0,streams=0 id=1,streams=1\"", "./manifest.mpd"})&#xA;

    &#xA;

    But I get this output :

    &#xA;

     cmd: /usr/bin/ffmpeg -f webm_dash_manifest -i ./480.webm -f webm_dash_manifest -i ./audio.webm -c copy -map 0:0 -map 1:0 -y -copy_unknown -f webm_dash_manifest -adaptation_sets "id=0,streams=0 id=1,streams=1" ./manifest.mpd -loglevel repeat&#x2B;level&#x2B;verbose&#xA; 2023/02/22 04:45:17 exit status 1&#xA; 2023/02/22 04:45:17 [info] ffmpeg version 5.1.2 Copyright (c) 2000-2022 the FFmpeg developers&#xA; [info]   built with gcc 12.2.1 (Alpine 12.2.1_git20220924-r3) 20220924&#xA; [info]   configuration: --prefix=/usr --enable-avfilter --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-gnutls --enable-gpl --enable-libass --enable-libmp3lame --enable-libpulse --enable-libvorbis --enable-libvpx --enable-libxvid --enable-libx264 --enable-libx265 --enable-libtheora --enable-libv4l2 --enable-libdav1d --enable-lto --enable-postproc --enable-pic --enable-pthreads --enable-shared --enable-libxcb --enable-librist --enable-libsrt --enable-libssh --enable-libvidstab --disable-stripping --disable-static --disable-librtmp --disable-lzma --enable-libaom --enable-libopus --enable-libsoxr --enable-libwebp --enable-vaapi --enable-vdpau --enable-vulkan --enable-libdrm --enable-libzmq --optflags=-O2 --disable-debug --enable-libsvtav1&#xA; [info]   libavutil      57. 28.100 / 57. 28.100&#xA; [info]   libavcodec     59. 37.100 / 59. 37.100&#xA; [info]   libavformat    59. 27.100 / 59. 27.100&#xA; [info]   libavdevice    59.  7.100 / 59.  7.100&#xA; [info]   libavfilter     8. 44.100 /  8. 44.100&#xA; [info]   libswscale      6.  7.100 /  6.  7.100&#xA; [info]   libswresample   4.  7.100 /  4.  7.100&#xA; [info]   libpostproc    56.  6.100 / 56.  6.100&#xA; [webm_dash_manifest @ 0x7fcec2836100] [warning] Could not find codec parameters for stream 0 (Video: vp9, 1 reference frame, none(tv, progressive, left), 640x480): unspecified pixel format&#xA; Consider increasing the value for the &#x27;analyzeduration&#x27; (0) and &#x27;probesize&#x27; (5000000) options&#xA; [info] Input #0, webm_dash_manifest, from &#x27;./480.webm&#x27;:&#xA; [info]   Metadata:&#xA; [info]     title           : Big Buck Bunny, Sunflower version&#xA; [info]     GENRE           : Animation&#xA; [info]     MAJOR_BRAND     : isom&#xA; [info]     MINOR_VERSION   : 1&#xA; [info]     COMPATIBLE_BRANDS: isomavc1&#xA; [info]     COMPOSER        : Sacha Goedegebure&#xA; [info]     ARTIST          : Blender Foundation 2008, Janus Bager Kristensen 2013&#xA; [info]     COMMENT         : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net&#xA; [info]     ENCODER         : Lavf59.27.100&#xA; [info]   Duration: 00:10:34.60, bitrate: 352 kb/s&#xA; [info]   Stream #0:0: Video: vp9, 1 reference frame, none(tv, progressive, left), 640x480, SAR 853:640 DAR 853:480, 30 fps, 30 tbr, 1k tbn (default)&#xA; [info]     Metadata:&#xA; [info]       HANDLER_NAME    : GPAC ISO Video Handler&#xA; [info]       VENDOR_ID       : [0][0][0][0]&#xA; [info]       ENCODER         : Lavc59.37.100 libvpx-vp9&#xA; [info]       DURATION        : 00:10:34.600000000&#xA; [info]       webm_dash_manifest_duration: 634600&#xA; [info]       webm_dash_manifest_initialization_range: 889&#xA; [info]       webm_dash_manifest_file_name: 480.webm&#xA; [info]       webm_dash_manifest_track_number: 1&#xA; [info]       webm_dash_manifest_cues_start: 27924928&#xA; [info]       webm_dash_manifest_cues_end: 27927508&#xA; [info]       webm_dash_manifest_bandwidth: 738287&#xA; [info]       webm_dash_manifest_cluster_keyframe: 1&#xA; [info]       webm_dash_manifest_cue_timestamps: 67,5067,10067,15067,20067,25067,30067,35067,40067,45067,50067,55067,60067,65067,70067,75067,80067,85067,90067,95067,100067,105067,110067,115067,120067,125067,130067,135067,140067,145067,150067,155067,160067,165067,170067,175067,180067,185067,190067,195067&#xA; [info] Input #1, webm_dash_manifest, from &#x27;./audio.webm&#x27;:&#xA; [info]   Metadata:&#xA; [info]     title           : Big Buck Bunny, Sunflower version&#xA; [info]     GENRE           : Animation&#xA; [info]     MAJOR_BRAND     : isom&#xA; [info]     MINOR_VERSION   : 1&#xA; [info]     COMPATIBLE_BRANDS: isomavc1&#xA; [info]     COMPOSER        : Sacha Goedegebure&#xA; [info]     ARTIST          : Blender Foundation 2008, Janus Bager Kristensen 2013&#xA; [info]     COMMENT         : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net&#xA; [info]     ENCODER         : Lavf59.27.100&#xA; [info]   Duration: 00:05:35.91, bitrate: 120 kb/s&#xA; [info]   Stream #1:0: Audio: vorbis, 48000 Hz, 5.1, fltp (default)&#xA; [info]     Metadata:&#xA; [info]       HANDLER_NAME    : GPAC ISO Audio Handler&#xA; [info]       VENDOR_ID       : [0][0][0][0]&#xA; [info]       ENCODER         : Lavc59.37.100 libvorbis&#xA; [info]       DURATION        : 00:05:35.907000000&#xA; [info]       webm_dash_manifest_duration: 335907&#xA; [info]       webm_dash_manifest_initialization_range: 7411&#xA; [info]       webm_dash_manifest_file_name: audio.webm&#xA; [info]       webm_dash_manifest_track_number: 1&#xA; [info]       webm_dash_manifest_cues_start: 5047497&#xA; [info]       webm_dash_manifest_cues_end: 5048846&#xA; [info]       webm_dash_manifest_bandwidth: 126994&#xA; [info]       webm_dash_manifest_cluster_keyframe: 1&#xA; [info]       webm_dash_manifest_cue_timestamps: 0,4986,9980,14962,19959,24956,29946,34930,39916,44911,49908,54892,59874,64868,69858,74858,79855,84847,89834,94834,99826,104826,109826,114818,119812,124799,129780,134770,139756,144743,149727,154719,159714,164706,169698,174687,179668,184667,189658,194650,19&#xA; HERE&#x27;S THE ERROR --> [error] Could not write header for output file #0 (incorrect codec parameters ?): Operation not permitted&#xA; [error] Error initializing output stream 0:1 -- &#xA; [info] Stream mapping:&#xA; [info]   Stream #0:0 -> #0:0 (copy)&#xA; [info]   Stream #1:0 -> #0:1 (copy)&#xA; [error] &#xA; [AVIOContext @ 0x7fcebe23a840] [verbose] Statistics: 0 bytes written, 0 seeks, 0 writeouts&#xA; [AVIOContext @ 0x7fcebe23a980] [verbose] Statistics: 5940786 bytes read, 133 seeks&#xA; [AVIOContext @ 0x7fcebe23acc0] [verbose] Statistics: 2260628 bytes read, 72 seeks&#xA;

    &#xA;

    It works perfectly however if I run it within docker exec (exec into the container and run the command in bash). Also, note in the last output that the command is well formed when I print it out from go. File permissions are also not the problem since the command to create the video variants works with os.exec i.e

    &#xA;

    runFFmpeg([]string{"-i", originalFilePath, "-c:v", "libvpx-vp9", "-keyint_min", "150", "-g", "150", "-tile-columns", "4", "-frame-parallel", "1", "-f", "webm", "-dash", "1", "-an", "-vf", fmt.Sprintf("scale=%s:%s", width, height), "-b:v", bitRate, "-dash", "1", "-y", destinationFilePath})&#xA;

    &#xA;