Recherche avancée

Médias (1)

Mot : - Tags -/Christian Nold

Autres articles (77)

  • MediaSPIP version 0.1 Beta

    16 avril 2011, par

    MediaSPIP 0.1 beta est la première version de MediaSPIP décrétée comme "utilisable".
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Pour avoir une installation fonctionnelle, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

  • Amélioration de la version de base

    13 septembre 2013

    Jolie sélection multiple
    Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
    Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...)

  • Mise à jour de la version 0.1 vers 0.2

    24 juin 2013, par

    Explications des différents changements notables lors du passage de la version 0.1 de MediaSPIP à la version 0.3. Quelles sont les nouveautés
    Au niveau des dépendances logicielles Utilisation des dernières versions de FFMpeg (>= v1.2.1) ; Installation des dépendances pour Smush ; Installation de MediaInfo et FFprobe pour la récupération des métadonnées ; On n’utilise plus ffmpeg2theora ; On n’installe plus flvtool2 au profit de flvtool++ ; On n’installe plus ffmpeg-php qui n’est plus maintenu au (...)

Sur d’autres sites (14214)

  • 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

    


  • ffmpeg says "No JPEG data found in image" when reading image paths from Linux pipe

    18 septembre 2021, par user16945608

    I'm trying to convert a set of pictures into a video, and I want to read the file paths of the pictures from the pipe. The command I would like to run looks like this :

    


    find dir/*.JPG | sort | ffmpeg -f image2pipe -r 1 -vcodec mjpeg -s 6000x4000 -pix_fmt yuvj422p -i - -vcodec libx264 -s 1080x720 -r 20 -pix_fmt yuv420p out.mkv

    


    But I keep obtaining the No JPEG data found in image error. Here is the full log :

    


    Input #0, image2pipe, from 'pipe:':
  Duration: N/A, bitrate: N/A
  Stream #0:0: Video: mjpeg, yuvj422p(bt470bg/unknown/unknown), 6000x4000, 1 fps, 1 tbr, 1 tbn, 1 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
[mjpeg @ 0x558e98cd7300] No JPEG data found in image
Error while decoding stream #0:0: Invalid data found when processing input
[swscaler @ 0x558e98ce9440] deprecated pixel format used, make sure you did set range correctly
[libx264 @ 0x558e98cdaac0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x558e98cdaac0] profile High, level 3.1, 4:2:0, 8-bit
[libx264 @ 0x558e98cdaac0] 264 - core 161 r3039 544c61f - H.264/MPEG-4 AVC codec - Copyleft
2003-2021 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=20 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, matroska, to 'out.mkv':
  Metadata:
    encoder         : Lavf58.76.100
  Stream #0:0: Video: h264 (H264 / 0x34363248), yuv420p, 1080x720, q=2-31, 20 fps, 1k tbn
    Metadata:
      encoder         : Lavc58.134.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
frame=    0 fps=0.0 q=0.0 Lsize=       1kB time=00:00:00.00 bitrate=N/A speed=   0x
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Conversion failed!


    


    The pictures are in the following format (with mediainfo) and the filenames are in the form DSC_1234.JPG :

    


    Format                                   : JPEG
Video
Format                                   : JPEG
Width                                    : 6 000 pixels
Height                                   : 4 000 pixels
Display aspect ratio                     : 3:2
Color space                              : YUV
Chroma subsampling                       : 4:2:2
Bit depth                                : 8 bits
Compression mode                         : Lossy


    


    Also, I would like to avoid using a solution without piping the paths (with -f image2 -i DSC_%04d.JPG for example). Do you have any idea what's happening ?

    


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

    


    Our full command is the following :

    


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


    


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

    


    file /tmp/media/tmppjdk_2jd.jpg
duration 0.049911
file /tmp/media/tmptjuoz56b.jpg
duration 0.050015
file /tmp/media/tmpzywkxe16.jpg
duration 0.049960
...


    


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

    


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


    


    Any ideas on how I can properly debug this ?