Recherche avancée

Médias (1)

Mot : - Tags -/book

Autres articles (105)

  • 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 ;

  • Emballe médias : à quoi cela sert ?

    4 février 2011, par

    Ce plugin vise à gérer des sites de mise en ligne de documents de tous types.
    Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ;

  • Soumettre améliorations et plugins supplémentaires

    10 avril 2011

    Si vous avez développé une nouvelle extension permettant d’ajouter une ou plusieurs fonctionnalités utiles à MediaSPIP, faites le nous savoir et son intégration dans la distribution officielle sera envisagée.
    Vous pouvez utiliser la liste de discussion de développement afin de le faire savoir ou demander de l’aide quant à la réalisation de ce plugin. MediaSPIP étant basé sur SPIP, il est également possible d’utiliser le liste de discussion SPIP-zone de SPIP pour (...)

Sur d’autres sites (14846)

  • Python ffmpeg subprocess : Broken pipe [closed]

    11 décembre 2022, par Pikkostack

    The following script reads a video with OpenCV, applies a transformation to each frame and attempts to write it with ffmpeg. My problem is, that I don't get ffmpeg working with the subprocess module. I always get the error BrokenPipeError: [Errno 32] Broken pipe in the line where I try to write to stdin. Why is that, what am I doing wrong ?

    



    # Open input video with OpenCV
video_in = cv.VideoCapture(src_video_path)
frame_width = int(video_in.get(cv.CAP_PROP_FRAME_WIDTH))
frame_height = int(video_in.get(cv.CAP_PROP_FRAME_HEIGHT))
fps = video_in.get(cv.CAP_PROP_FPS)
frame_count = int(video_in.get(cv.CAP_PROP_FRAME_COUNT))
bitrate = bitrate * 4096 * 2160 / (frame_width * frame_height)

# Process video in ffmpeg pipe
# See http://zulko.github.io/blog/2013/09/27/read-and-write-video-frames-in-python-using-ffmpeg/
command = ['ffmpeg',
           '-loglevel', 'error',
           '-y',
           # Input
           '-f', 'rawvideo',
           '-vcodec', 'rawvideo'
           '-pix_fmt', 'bgr24',
           '-s', str(frame_width) + 'x' + str(frame_height),
           '-r', str(fps),
           # Output
           '-i', '-',
           '-an',
           '-vcodec', 'h264',
           '-r', str(fps),
           '-b:v', str(bitrate) + 'M',
           '-pix_fmt', 'bgr24',
           dst_video_path
           ]
pipe = sp.Popen(command, stdin=sp.PIPE)

for i_frame in range(frame_count):
    ret, frame = video_in.read()
    if ret:
        warped_frame = cv.warpPerspective(frame, homography, (frame_width, frame_height))
        pipe.stdin.write(warped_frame.astype(np.uint8).tobytes())
    else:
        print('Stopped early.')
        break
print('Done!')


    


  • FFmpeg : Pipe segments to s3

    24 septembre 2024, par Brendan Kennedy

    I'd like to pipe ffmpeg segments to s3 without writing them to disk.

    


    ffmpeg -i t2.mp4 -map 0 -c copy -f segment -segment_time 20 output_%04d.mkv


    


    Is it possible to modify this command so that ffmpeg writes segments to an s3 bucket ? Something like this perhaps ?

    


    ffmpeg -i t2.mp4 -map 0 -c copy -f segment -segment_time 20 pipe:1 \
  | aws s3 cp - s3://bucket/output_%04d.mkv


    


    When I run the command above I receive this error

    


    Could not write header for output file #0
(incorrect codec parameters ?): Muxer not found


    


    This command works except the entire video is uploaded and not the individual segments

    


    ffmpeg -i t2.mp4 -map 0 -c copy -f segment -segment_time 20 pipe:output_%04d.mkv \
| aws s3 cp - s3://bucket/test.mkv


    


  • OpenCV Python, reading video from named-pipe

    29 février 2020, par BlueNut

    I am trying to achieve results as shown on the video (Method 3 using netcat) https://www.youtube.com/watch?v=sYGdge3T30o
    It is to stream video from raspberry pi to PC and process it using openCV and python.

    I use command

    raspivid -vf -n -w 640 -h 480 -o - -t 0 -b 2000000 | nc 192.168.1.137 8000

    to stream the video to my PC and then on the PC I created name pipe ’fifo’ and redirected the output

    nc -l -p 8000 -v > fifo

    then i am trying to read the pipe and display the result in the python script

    import cv2
    import subprocess as sp
    import numpy

    FFMPEG_BIN = "ffmpeg.exe"
    command = [ FFMPEG_BIN,
           '-i', 'fifo',             # fifo is the named pipe
           '-pix_fmt', 'bgr24',      # opencv requires bgr24 pixel format.
           '-vcodec', 'rawvideo',
           '-an','-sn',              # we want to disable audio processing (there is no audio)
           '-f', 'image2pipe', '-']    
    pipe = sp.Popen(command, stdout = sp.PIPE, bufsize=10**8)

    while True:
       # Capture frame-by-frame
       raw_image = pipe.stdout.read(640*480*3)
       # transform the byte read into a numpy array
       image =  numpy.frombuffer(raw_image, dtype='uint8')
       image = image.reshape((480,640,3))          # Notice how height is specified first and then width
       if image is not None:
           cv2.imshow('Video', image)

       if cv2.waitKey(1) & 0xFF == ord('q'):
           break
       pipe.stdout.flush()

    cv2.destroyAllWindows()

    But I got this error :

    Traceback (most recent call last):
     File "C:\Users\Nick\Desktop\python video stream\stream.py", line 19, in <module>
       image = image.reshape((480,640,3))          # Notice how height is specified first and then width
    ValueError: cannot reshape array of size 0 into shape (480,640,3)
    </module>

    It seems that the numpy array is empty, so any ideas to fix this ?