Recherche avancée

Médias (91)

Autres articles (57)

  • 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

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

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

Sur d’autres sites (8795)

  • 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

    


  • fate : update ref files after a recent change

    29 octobre 2021, par James Almer
    fate : update ref files after a recent change
    

    Missed in 3925b826df365a2365118600bd7910cbca95286d.

    Signed-off-by : James Almer <jamrial@gmail.com>

    • [DH] tests/ref/fate/iv8-demux
    • [DH] tests/ref/fate/segment-mp4-to-ts
  • "No JPEG data found in image" when using ffmpeg concat

    7 juillet 2021, par bpgeck

    We are using FFMPEG for some image processing. We are attempting to concatenate a series of images into one single video file using ffmpeg concat, similar to what is described in this guide.

    &#xA;

    Our full command is the following :

    &#xA;

    ffmpeg -loglevel debug -y concat -safe 0 -i /tmp/infile.txt -pix_fmt yuvj420p -c:v libx264 -bsf:v h264_mp4toannexb /tmp/outfile.ts&#xA;

    &#xA;

    This infile.txt contains a list of the image file names and the duration that image should take up in the video :

    &#xA;

    file /tmp/media/tmppjdk_2jd.jpg&#xA;duration 0.049911&#xA;file /tmp/media/tmptjuoz56b.jpg&#xA;duration 0.050015&#xA;file /tmp/media/tmpzywkxe16.jpg&#xA;duration 0.049960&#xA;...&#xA;

    &#xA;

    When running this command, however, I see the following error :

    &#xA;

    [mjpeg @ 0x565013c4b800] No JPEG data found in image&#xA;Error while decoding stream #0:0: Invalid data found when processing input&#xA;[mjpeg @ 0x565013c4b800] No JPEG data found in image&#xA;Error while decoding stream #0:0: Invalid data found when processing input&#xA;[mjpeg @ 0x565013c4b800] No JPEG data found in image&#xA;Error while decoding stream #0:0: Invalid data found when processing input&#xA;[mjpeg @ 0x565013c4b800] No JPEG data found in image&#xA;Error while decoding stream #0:0: Invalid data found when processing input&#xA;...&#xA;opping st:0&#xA;DTS 243, next:3170350840000 st:0 invalid dropping&#xA;PTS 243, next:3170350840000 invalid dropping st:0&#xA;DTS 244, next:3170350880000 st:0 invalid dropping&#xA;PTS 244, next:3170350880000 invalid dropping st:0&#xA;DTS 245, next:3170350920000 st:0 invalid dropping&#xA;PTS 245, next:3170350920000 invalid dropping st:0&#xA;DTS 246, next:3170350960000 st:0 invalid dropping&#xA;PTS 246, next:3170350960000 invalid dropping st:0&#xA;DTS 248, next:3170351000000 st:0 invalid dropping&#xA;PTS 248, next:3170351000000 invalid dropping st:0&#xA;

    &#xA;

    Any ideas on how I can properly debug this ?

    &#xA;