Recherche avancée

Médias (91)

Autres articles (79)

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

  • Support audio et vidéo HTML5

    10 avril 2011

    MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
    Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
    Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
    Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...)

  • Mediabox : ouvrir les images dans l’espace maximal pour l’utilisateur

    8 février 2011, par

    La visualisation des images est restreinte par la largeur accordée par le design du site (dépendant du thème utilisé). Elles sont donc visibles sous un format réduit. Afin de profiter de l’ensemble de la place disponible sur l’écran de l’utilisateur, il est possible d’ajouter une fonctionnalité d’affichage de l’image dans une boite multimedia apparaissant au dessus du reste du contenu.
    Pour ce faire il est nécessaire d’installer le plugin "Mediabox".
    Configuration de la boite multimédia
    Dès (...)

Sur d’autres sites (5806)

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


    


  • How to stream a video from localhost to web browser using video tag ?

    31 juillet 2021, par kup

    Basically what i want to stream a video to my browser both on localhost, using flask and opencv or ffmpeg.

    


    But not sure how to do it.

    


    i tried this :

    


    #!/usr/bin/env python
from flask import Flask, render_template, Response
import cv2
import sys
import numpy

app = Flask(__name__)

def get_frame():
    c=cv2.VideoCapture("output.mkv") 

    while True:
        retval, im = c.read()
        imgencode=cv2.imencode('.jpg',im)[1]
        stringData=imgencode.tostring()
        yield (b'--frame\r\n'
            b'Content-Type: text/plain\r\n\r\n'+stringData+b'\r\n')

    del(c)

@app.route('/vid')
def vid():
     return Response(get_frame(),mimetype='multipart/x-mixed-replace; boundary=frame')


if __name__ == '__main__':
    app.run(host='localhost',port=5000, debug=True, threaded=True)


    


    but its not working may be because it is sending images, how can i stream video ?

    


  • ffmepg why error :Failed to write core dump

    9 juillet 2021, par dmouse

    I wang to implement a feature that allows me to save RTSP stram as a file,
use javacv implement a demo,but there's an error.
i debug the demo , execute 'recorder.record(frame) ;' error, "ulimit -c unlimited" is useless,the program still reports an error.
review of the source code did note find the problem principle.pleace give me a hand.

    


    import org.bytedeco.javacpp.avcodec;
import org.bytedeco.javacv.FFmpegFrameGrabber;
import org.bytedeco.javacv.FFmpegFrameRecorder;
import org.bytedeco.javacv.Frame;

import java.io.File;
import java.io.IOException;

/**
 * @ClassName video
 * @Description TODO
 * @Author mouse
 * @Date 2021/7/9 11:13
 * @Version 1.0
 **/
public class Video {
    public static void main(String[] args) {
        String streamUrl = "rtsp://admin:12345678.@192.168.20.180:554/h265/ch1/main/av_stream";
        String filePath = "./video/hello.mp3";
        File outFile = new File(filePath);
        FFmpegFrameGrabber grabber = new FFmpegFrameGrabber(streamUrl);
        if (!outFile.getParentFile().exists()) {
            outFile.getParentFile().mkdirs();
        }
        FFmpegFrameRecorder recorder = new FFmpegFrameRecorder(filePath,1080,1440, 1);
        recorder.setVideoCodec(avcodec.AV_CODEC_ID_H265);
        recorder.setFormat("flv");
        recorder.setVideoBitrate(4000);
        try {
            grabber.start();
            recorder.start();
            Frame frame = grabber.grabFrame();
            while (frame!=null){
                recorder.record(frame);
                frame = grabber.grabFrame();
            }
            recorder.record(frame);
            recorder.stop();
            grabber.stop();

        } catch (FFmpegFrameGrabber.Exception e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                if (recorder != null) {
                    recorder.stop();
                }
                if (grabber != null) {
                    grabber.stop();
                }
            } catch (FFmpegFrameRecorder.Exception | FFmpegFrameGrabber.Exception e) {
                e.printStackTrace();
            }
        }
    }
}



    


    log error

    


    #
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x0000000131fef233, pid=50498, tid=0x0000000000001003
#
# JRE version: Java(TM) SE Runtime Environment (8.0_281-b09) (build 1.8.0_281-b09)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.281-b09 mixed mode bsd-amd64 compressed oops)
# Problematic frame:
# C  [libavformat.57.dylib+0xbf233]  av_write_frame+0x993
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#


    


    pom :

    


            <dependency>&#xA;            <groupid>org.bytedeco</groupid>&#xA;            <artifactid>javacv</artifactid>&#xA;            <version>1.4.3</version>&#xA;        </dependency>&#xA;        <dependency>&#xA;            <groupid>org.bytedeco.javacpp-presets</groupid>&#xA;            <artifactid>ffmpeg-platform</artifactid>&#xA;            <version>4.0.2-1.4.3</version>&#xA;        </dependency>&#xA;

    &#xA;

    My os : macOS Bgi Sur 11.4 ;
    &#xA;JDK : 1.8.0_281
    &#xA;execute 'recorder.record(frame) ;' error,&#xA;"ulimit -c unlimited" is useless,the program still reports an error .

    &#xA;