Recherche avancée

Médias (91)

Autres articles (62)

  • Le profil des utilisateurs

    12 avril 2011, par

    Chaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
    L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)

  • Configurer la prise en compte des langues

    15 novembre 2010, par

    Accéder à la configuration et ajouter des langues prises en compte
    Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
    De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
    Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...)

  • Sélection de projets utilisant MediaSPIP

    29 avril 2011, par

    Les exemples cités ci-dessous sont des éléments représentatifs d’usages spécifiques de MediaSPIP pour certains projets.
    Vous pensez avoir un site "remarquable" réalisé avec MediaSPIP ? Faites le nous savoir ici.
    Ferme MediaSPIP @ Infini
    L’Association Infini développe des activités d’accueil, de point d’accès internet, de formation, de conduite de projets innovants dans le domaine des Technologies de l’Information et de la Communication, et l’hébergement de sites. Elle joue en la matière un rôle unique (...)

Sur d’autres sites (4488)

  • How to receive byte-stream by using gstreamer with python subprocess module or gst-launch-1.0 command ?

    21 avril 2022, par yuniversi

    I want to receive byte-stream by using gstreamer with python subprocess module.
Now I can successfully use ffmpeg to pull the byte-stream. As shown below.

    


    import cv2
import subprocess as sp


height = 714
width = 420
rtsp_url = 'rtsp://127.0.0.1:8554/video'

# command
command = ['ffmpeg',
            '-i', rtsp_url,
            '-f', 'rawvideo',
            '-s',str(width)+'*'+str(height),
            '-pix_fmt', 'bgr24',
            '-fflags', 'nobuffer',
            '-']

p = sp.Popen(command, stdout=sp.PIPE, bufsize=10**8)

while True:
    raw_image = p.stdout.read(width*height*3)
    image =  np.fromstring(raw_image, dtype='uint8')
    image = image.reshape((height,width,3)).copy()
    cv2.imshow('image', image)
    key = cv2.waitKey(20)


    


    I want to use gstreamer command instead of ffmpeg. So far, I have realized writing byte-stream to a file by using gstreamer command line.

    


    gst-launch-1.0 rtspsrc location=rtsp://127.0.0.1:8554/video latency=0 drop-on-latency=true ! rtph264depay ! video/x-h264, stream-format='byte-stream' ! filesink location=/home/name/stdout


    


    But it can't output byte-stream to pipe, so the terminal dosen't display byte-stream, not like ffmpeg command. How to change this command to output byte-stream through pipe so I can read from pipe.
Thank you for taking the time to answer for me !

    


    This is RTSP streaming code.

    


    import cv2
import time
import subprocess as sp
import numpy as np


rtsp_url = 'rtsp://127.0.0.1:8554/video'
video_path = r'test.mp4'
cap = cv2.VideoCapture(video_path)

# Get video information
fps = int(cap.get(cv2.CAP_PROP_FPS))
width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
print('fps={}'.format(fps))

# command
command = ['ffmpeg',
            '-re',
            '-y',
            '-stream_loop', '-1',
            '-f', 'rawvideo',
            '-vcodec', 'rawvideo',
            '-pix_fmt', 'bgr24',
            '-s', "{}x{}".format(width, height),
            '-r', str(fps),
            '-i', '-',
            '-c:v', 'libx264',
            '-pix_fmt', 'yuv420p',
            '-preset', 'ultrafast',
            # '-flags2', 'local_header',
            '-bsf:v', "'dump_extra=freq=k'", 
            '-keyint_min', '60',
            '-g', '60',
            '-sc_threshold', '0', 
            '-f', 'rtsp',
            '-rtsp_transport', 'tcp',
            '-muxdelay', '0.1', 
            rtsp_url]

p = sp.Popen(command, stdin=sp.PIPE)

cnt = 0
t_start = time.time()
while (cap.isOpened()):
    t_cur = time.time()-t_start

    ret, frame = cap.read()
    if not ret:
        cnt += 1
        print("count: {}".format(cnt))
        cap = cv2.VideoCapture(video_path)
        continue

    p.stdin.write(frame.tobytes())

    cv2.imshow('real_time', frame)

    key = cv2.waitKey(20)
    if key == 27:
        p.terminate()
        break


    


  • rtmp module stream do not , how to solve that ?

    24 avril 2019, par Duxo

    I have some problem with configuring nginx+rtk-©module.
    I need to stream a video from IP camera to web-site. I use MPEG-DASH.My server configuration is lower. Files .m4a, .m4v are creating and I also have stream.mpd file. But in browser it doen’t work, inifinity loading. some logs from dash.js

    Time: 0
    dash.all.js:2:10794
    Array(6) [ {…}, {…}, {…}, {…}, {…}, {…} ]
    dash.all.js:2:10818
    Index for time 0 is -1
    dash.all.js:3:8722
    Checking for stream end...
    dash.all.js:3:8722
    Live never ends! (TODO)
    dash.all.js:3:8722
    Stream finished? false
    dash.all.js:3:8722
    Got a request.
    dash.all.js:3:8722
    null
    dash.all.js:3:8722
    BufferController video setState to:READY
    dash.all.js:3:8722
    Working time is video time: 0
    dash.all.js:3:8722
    BufferController.validate() video | state: READY
    dash.all.js:3:8722
    video Playback rate: 0
    dash.all.js:3:8722
    video Working time: 0
    dash.all.js:3:8722
    video Video time: 0
    dash.all.js:3:8722
    Current video buffer length: 0
    dash.all.js:3:8722
    BufferController video setState to:VALIDATING
    dash.all.js:3:8722
    ABR enabled? (true)
    dash.all.js:3:8722
    Check ABR rules.
    dash.all.js:3:8722
    Checking download ratio rule...
    dash.all.js:3:8722
    Total time: 0.009s
    dash.all.js:3:8722
    Download time: 0.009s
    dash.all.js:3:8722
    The ratios are NaN, bailing.
    dash.all.js:3:8722
    Checking insufficient buffer rule...
    dash.all.js:3:8722
    Not enough information for rule.
    dash.all.js:3:8722
    Array [ {…}, {…} ]
    dash.all.js:3:8722
    New quality of 0
    dash.all.js:3:8722
    video Playback quality: 0
    dash.all.js:3:8722
    Populate video buffers.
    dash.all.js:3:8722
    Quality didn't change.
    dash.all.js:3:8722
    Loading the video fragment for time: 0
    dash.all.js:3:8722
    Getting the request for time: 0
    dash.all.js:3:8722
    Got segments.
    dash.all.js:3:8722
    Array(6) [ {…}, {…}, {…}, {…}, {…}, {…} ]
    dash.all.js:3:8722
    Got a list of segments, so dig deeper.
    dash.all.js:3:8722
    Couldn't figure out a time!
    dash.all.js:2:10751
    Time: 0
    dash.all.js:2:10794
    Array(6) [ {…}, {…}, {…}, {…}, {…}, {…} ]
    dash.all.js:2:10818
    Index for time 0 is -1
    dash.all.js:3:8722
    Checking for stream end...
    dash.all.js:3:8722
    Live never ends! (TODO)
    dash.all.js:3:8722
    Stream finished? false
    dash.all.js:3:8722
    Got a request.
    dash.all.js:3:8722
    null
    dash.all.js:3:8722
    BufferController video setState to:READY
    dash.all.js:3:8722
    Working time is video time: 0
    dash.all.js:3:8722
    BufferController.validate() video | state: READY
    dash.all.js:3:8722
    video Playback rate: 0
    dash.all.js:3:8722
    video Working time: 0
    dash.all.js:3:8722
    video Video time: 0
    dash.all.js:3:8722
    Current video buffer length: 0
    dash.all.js:3:8722
    BufferController video setState to:VALIDATING
    dash.all.js:3:8722
    ABR enabled? (true)
    dash.all.js:3:8722
    Check ABR rules.
    dash.all.js:3:8722
    Checking download ratio rule...
    dash.all.js:3:8722
    Total time: 0.009s
    dash.all.js:3:8722
    Download time: 0.009s
    dash.all.js:3:8722
    The ratios are NaN, bailing.
    user some_user;
    worker_processes  1;

    events {
       worker_connections  1024;
    }

    rtmp {
       live on;
       dash on;
       server {
           listen 1935;
           application cams {
           dash_path /cams;
       }
           exec_static ffmpeg -i
    rtsp://admin:admin@192.168.0.51/1/Streaming/Channels/1/ -c:v libx264 -q:v 31 -an -profile:v baseline -ar 44100
    -f flv rtmp://0.0.0.0/cams/stream;

       }
    }

    http {
       include       mime.types;
       default_type  application/octet-stream;

       sendfile        on;

       #keepalive_timeout  0;
       keepalive_timeout  65;


       server {
           listen       80;
           server_name  localhost;

           location / {
               root /;
           }

           error_page   500 502 503 504  /50x.html;
           location = /50x.html {
               root   html;
           }

    }

    Can someone explain me why stream is not working and how to issue that ?thanks

  • nginx rtmp module fails to stream MP4 format

    23 avril 2019, par Keivan

    I have media server running on Nginx rtmp module + ffmpeg
    It is working 100% fine with FLV format but with MP4 it does not create .m3u8 file and stream chunks.
    here is nginx.conf file :

    worker_processes  auto;

    events {
       worker_connections  1024;
       multi_accept on;
    }

    rtmp {
     server {
       listen 1935;
       chunk_size 4000;

       application live {
           live on;
           record off;

           hls on;
       hls_path        /HLS/live;

           hls_keys on;
           hls_key_path       /HLS/keys;
           hls_key_url        https://fakeurl:8441/keys/;
       hls_fragments_per_key   10;

           hls_fragment 3s;
           hls_playlist_length 10s;
           deny play all;
       }
     }
    }

    http {
       include       mime.types;
       tcp_nopush on;
       directio 512;
       default_type  application/octet-stream;
       sendfile      off;

       server {
           listen       8441 ssl;
       server_name  fakeurl;

           ssl_certificate /home/ubuntu/Keys/server.crt;
           ssl_certificate_key /home/ubuntu/Keys/server.key;

           location /keys {
               root /HLS/;
           }

           location / {
               root   html;
               index  index.html index.htm;
           }

           location /live {

               # Disable cache
               add_header 'Cache-Control' 'no-cache';

               # CORS setup
               add_header 'Access-Control-Allow-Origin' '*' always;
               add_header 'Access-Control-Expose-Headers' 'Content-Length';

               # allow CORS preflight requests
               if ($request_method = 'OPTIONS') {
                   add_header 'Access-Control-Allow-Origin' '*';
                   add_header 'Access-Control-Max-Age' 1728000;
                   add_header 'Content-Type' 'text/plain charset=UTF-8';
                   add_header 'Content-Length' 0;
                   return 204;
               }

               types {
                   application/vnd.apple.mpegurl m3u8;
               }

               root /HLS/;
           }


           #error_page  404              /404.html;

           # redirect server error pages to the static page /50x.html
           #
           error_page   500 502 503 504  /50x.html;
           location = /50x.html {
               root   html;
           }
       }
    }

    and this is FFmpeg command for creating converting my RTP stream to MP4 and stream it to RTMP server :

    ffmpeg -protocol_whitelist 'file,udp,rtp' -i input.sdp -c:v libx264 -pix_fmt yuv420p -profile:v baseline -level 3.0 -g 30 -r 30 -c:a aac -b:v 400k -preset ultrafast -tune zerolatency -movflags frag_keyframe -f mp4 rtmp://0.0.0.0:1935/live/stream1

    I can confirm ffmpeg works fine and it is stable with the input stream, if I change output format to flv, rtmp server creates stream1.m3u8 file and everything is fine. But with mp4, mov or m4v formats nginx does not create anything.