Recherche avancée

Médias (91)

Autres articles (26)

  • Création définitive du canal

    12 mars 2010, par

    Lorsque votre demande est validée, vous pouvez alors procéder à la création proprement dite du canal. Chaque canal est un site à part entière placé sous votre responsabilité. Les administrateurs de la plateforme n’y ont aucun accès.
    A la validation, vous recevez un email vous invitant donc à créer votre canal.
    Pour ce faire il vous suffit de vous rendre à son adresse, dans notre exemple "http://votre_sous_domaine.mediaspip.net".
    A ce moment là un mot de passe vous est demandé, il vous suffit d’y (...)

  • Les tâches Cron régulières de la ferme

    1er décembre 2010, par

    La gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
    Le super Cron (gestion_mutu_super_cron)
    Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...)

  • Taille des images et des logos définissables

    9 février 2011, par

    Dans beaucoup d’endroits du site, logos et images sont redimensionnées pour correspondre aux emplacements définis par les thèmes. L’ensemble des ces tailles pouvant changer d’un thème à un autre peuvent être définies directement dans le thème et éviter ainsi à l’utilisateur de devoir les configurer manuellement après avoir changé l’apparence de son site.
    Ces tailles d’images sont également disponibles dans la configuration spécifique de MediaSPIP Core. La taille maximale du logo du site en pixels, on permet (...)

Sur d’autres sites (4031)

  • AWS Lambda and Fluent FFMPEG error "cannot read property "isStream" of undefined"

    29 mai 2021, par Travis Lee

    so here's the goal : convert a .webm file hosted in an S3 into a gif and upload that to a new bucket. This all works fine when run locally, but when trying to translate it into a lambda, fluent-ffmpeg throws errors when it runs the command.

    


    Here's the code snippet :

    


    ffmpeg(new URL(vid))
  .outputOptions("-vf", "scale=320:-1:flags=lanczos,fps=14")
  .on('progress', () => {
      console.log('progress');
  })
  .on('end', () => {
     //Do stuff with the result when it is done
  })
  .output(newKey)
  .run(newKey);


    


    in this snippet, "vid" is a presigned GET url for an S3 bucket containing the .webm video file, and "newKey" is the name of the new bucket (and a temporary writeStream/File that is created in the lambda to store the new .gif file until we upload it to S3 - not super relevant to this issue).

    


    What should happen (and does locally) is that a new output is created containing the converted .gif file

    


    What happens when it is deployed in a lambda is that it reaches the .outputOptions call and throws a type error saying that it cannot read property isStream of undefined.

    


    At first glance, this seems like I simply don't have FFMPEG installed in the lambda, but I do. I have tried with the prebuilt layer using NodeJS 10 found here : https://serverlessrepo.aws.amazon.com/applications/us-east-1/145266761615/ffmpeg-lambda-layer ,
with a NodeJS 12 layer that was built by some engineers here previously, and tried building a NodeJS 14 FFMPEG layer myself and using that. I tried for all three using no configuration and letting it call the PATH ffmpeg, using the FFMPEG_PATH and FFPROBE_PATH environment variables set to either what was specified in the previous layers, or what I made it in the newly built one, and even manually setting the path to the executables using the setFfmpegPath and setFfprobePath functions found on the fluent-ffmpeg object.

    


    Lastly, I even tried bundling the executables in with the actual lambda code itself and uploading it through an S3, trying all three above methods of getting it to point to the correct paths once again to no avail.

    


    I'm seriously in need of help if anyone else has encountered something similar or just might know what is going on. I'm at wit's end here trying to figure this out.

    


  • AWS EC2 and OpenCV with UDP consumer

    22 juillet 2021, par NoobZik

    I have two EC2

    


      

    • A That grabs the video feed from Amazon Kinesis Video to send it into via UDP to B
    • 


    • B the consumer which it will grab the UDP feed from the A
    • 


    


    While debugging my opencv not grabbing the UDP feed, I suspect something is wrong with ffpmeg, so I am going to make sure that ffplay can read packets sent from A.

    


    Now when I try to read udp packets with ffplay {adress-ip-with-port}I have the following error :

    


    Could not initialize SDL - No available video device
(Did you set the DISPLAY variable?)


    


    How do I fix this one since there is no display on EC2.

    


    Also if it can help, this is my code for the consumer part

    


     Create your views here.
from django.http import HttpResponse
from django.template import loader
from django.shortcuts import render
# from .models import Vehicule
import cv2
import threading
from django.views.decorators import gzip
from django.http import StreamingHttpResponse


@gzip.gzip_page
def webcam(request):
    try:
        cam = VideoCamera()
        return StreamingHttpResponse(gen(cam), content_type="multipart/x-mixed-replace;boundary=frame")
    except:
        pass
    return render(request, 'vebcam.html')

#capture video
class VideoCamera(object):
    def __init__(self):
        self.video = cv2.VideoCapture('udp://172.31.57.243:55055', cv2.CAP_FFMPEG)
        (self.grabbed, self.frame) = self.video.read()
        threading.Thread(target=self.update, args=()).start()

    def __del__(self):
        self.video.release()

    def get_frame(self):
        image = self.frame
        _, jpeg = cv2.imencode('.jpg', image)
        return jpeg.tobytes()

    def update(self):
        while True:
            (self.grabbed, self.frame) = self.video.read()

def gen(camera):
    while True:
        frame = camera.get_frame()
        yield (b'--frame\r\n'b'Content-Type: image/jpeg\r\n\r\n' + frame + b'\r\n\r\n')


    


    It runs fine on local but not on EC2

    


    This is the log that led me to check ffplay

    


    Traceback (most recent call last):
  File "/usr/lib/python3.8/wsgiref/handlers.py", line 138, in run
    self.finish_response()
  File "/usr/lib/python3.8/wsgiref/handlers.py", line 183, in finish_response
    for data in self.result:
  File "/home/ubuntu/.local/lib/python3.8/site-packages/django/utils/text.py", line 304, in compress_sequence
    for item in sequence:
  File "/home/ubuntu/site/mysite/mysite/views.py", line 42, in gen
    frame = camera.get_frame()
  File "/home/ubuntu/site/mysite/mysite/views.py", line 33, in get_frame
    _, jpeg = cv2.imencode('.jpg', image)
cv2.error: OpenCV(4.5.3) /tmp/pip-req-build-xw6jtoah/opencv/modules/imgcodecs/src/loadsave.cpp:978: error: (-215:Assertion failed) !image.empty() in function 'imencode'


    


  • Python Lambda function and ffmpeg command with stdout from jpg to ts file

    28 juillet 2021, par Sflagg

    I have a AWS Lambda Python function setup to process jpg and convert it to a ts file.

    


    I followed these instructions https://aws.amazon.com/blogs/media/processing-user-generated-content-using-aws-lambda-and-ffmpeg/ but changed the command from vfr to cfr conversion to a jpg to ts conversion.

    


    This is the command I am using

    


    ffmpeg_cmd = "/opt/bin/ffmpeg -r 30000/1001 -loop 1 -i \"" + s3_source_signed_url + "\" -f lavfi -i anullsrc=channel_layout=stereo:sample_rate=48000 -t 30 -vcodec libx264 -crf 23 -s 1920x1080 -r 30000/1001 -g 150 -pix_fmt yuv420p -acodec aac -b:a 96k -ar 48000 -"

    


    Everything else is basically the same from the AWS article besides having s3 triggers in my Lambda look for jpeg and jpg suffixes.

    


    But this results in 0 byte ts file.

    


    I have a hunch that I need to modify the command that has a seekable output format (e.g. mpegts) when writing to stdout ; currently my command is likely not working for stdout and that is why I get an empty ts file. But I am having trouble formatting the command correctly. Any help with this would be greatly appreciated !