Recherche avancée

Médias (1)

Mot : - Tags -/censure

Autres articles (102)

  • Multilang : améliorer l’interface pour les blocs multilingues

    18 février 2011, par

    Multilang est un plugin supplémentaire qui n’est pas activé par défaut lors de l’initialisation de MediaSPIP.
    Après son activation, une préconfiguration est mise en place automatiquement par MediaSPIP init permettant à la nouvelle fonctionnalité d’être automatiquement opérationnelle. Il n’est donc pas obligatoire de passer par une étape de configuration pour cela.

  • Des sites réalisés avec MediaSPIP

    2 mai 2011, par

    Cette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
    Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page.

  • ANNEXE : Les plugins utilisés spécifiquement pour la ferme

    5 mars 2010, par

    Le site central/maître de la ferme a besoin d’utiliser plusieurs plugins supplémentaires vis à vis des canaux pour son bon fonctionnement. le plugin Gestion de la mutualisation ; le plugin inscription3 pour gérer les inscriptions et les demandes de création d’instance de mutualisation dès l’inscription des utilisateurs ; le plugin verifier qui fournit une API de vérification des champs (utilisé par inscription3) ; le plugin champs extras v2 nécessité par inscription3 (...)

Sur d’autres sites (9030)

  • Unable to Play Video Stream on Flask-FFmpeg Media Server on Subsequent Requests

    12 juin 2024, par yternal

    Problem Description :

    


    I am trying to create a media server using Flask and FFmpeg. The server converts an RTSP stream to FLV format for playback in a web browser, and I am testing it using ffplay. The server starts successfully, and the data returned from the first request can be played using ffplay. However, when I interrupt the ffplay request and make it again, ffplay is unable to play the video and displays an "Invalid data found when processing input" error.

    


    I am using the following command to test with ffplay :

    


    ffplay http://127.0.0.1:8000/flv/0


    


    My current Flask code:

    


    import queue
import subprocess
import threading

from flask import Flask, Response, stream_with_context
from gevent import monkey
from gevent.pool import Pool
from gevent.pywsgi import WSGIServer
from geventwebsocket.handler import WebSocketHandler
from loguru import logger

monkey.patch_all()
app = Flask(__name__)

stream_queue = queue.Queue(maxsize=10000)


def update_stream():
    process = subprocess.Popen(
        ['ffmpeg', '-i', 'rtsp://192.168.1.168/0', '-f', 'flv', '-'],
        stdout=subprocess.PIPE,
        stderr=subprocess.PIPE
    )
    while True:
        data = process.stdout.read(4096)
        if not data:
            break
        if stream_queue.full():
            stream_queue.get()
        stream_queue.put(data)
        logger.debug(f"stream_queue size: {stream_queue.qsize()}")


@app.route('/flv/')
def flv_stream(stream_id):
    @stream_with_context
    def generate():

        while True:
            data = stream_queue.get()
            yield data

    return Response(generate(), mimetype='video/x-flv')


if __name__ == '__main__':
    HOST = "0.0.0.0"
    PORT = 8000

    threading.Thread(target=update_stream, daemon=True).start()

    logger.info(f"listen in: {HOST}:{PORT}")
    pool = Pool(10000)
    http_serve = WSGIServer((HOST, PORT), app, handler_class=WebSocketHandler, spawn=pool)
    http_serve.max_accept = 30000
    http_serve.serve_forever()


    


    The error message when attempting to play the stream again with ffplay is :

    


    http://127.0.0.1:8000/flv/0: Invalid data found when processing input


    


    I tried adding some parameters to FFmpeg, such as analyzeduration and probesize, but it had no effect.

    


  • Getting ffmpeg to capture the full screen of xfvb-run screen running puppeteer script, and send it over rtmp

    30 janvier, par james

    My problem

    


    I can't get ffmpeg or xvfb-run to stream the full screen to ffplay/videolan, it only captures a part of the screen.

    


    Update 2

    


    I answered the question myself in a follow up answer, hopefully it can be useful for someone else with the same problem.

    


    Update 1

    


    So the problem is definitely with xvfb-run, since the two following commands, still give a webm file, that only show parts of the screen

    


    ffmpeg -f x11grab -i :99 -g 50 -b:v 4000k -maxrate 4000k -bufsize 8000k -f webm -s 384x216 "blank.webm"

    


    xvfb-run -n 99 -a --server-args="-screen 0 1024x8000x24 -ac -nolisten tcp -dpi 96 +extension RANDR" "node index.js"

    


    What I've tried

    


      

    • I've tried changing ffmpeg command and xvfb-run, for example adding "-vf format=yuv420p" or "-filter:v "crop=iw-400:ih-40,scale=960:720" to ffmpeg command
    • 


    • I've tried to show other applications under xvfb-run instead of puppeteer (chrome..)
    • 


    • Recording screen with ffmpeg and saving it to a file, to see if there's a problem with the rtmp stream
    • 


    


    But still no luck. That's why I'm reaching out to the stackoverflow community.

    


    xvfb-run command

    


    xvfb-run -n 99 -a --server-args="-screen 0 1024x8000x24 -ac -nolisten tcp -dpi 96 +extension RANDR" "node index.js"

    


    ffmpeg command to capture xvfb-run virtual screen

    


    ffmpeg -f x11grab -i :99 -f pulse -i default -c:v libx264 -c:a aac  -g 50 -b:v 4000k -maxrate 4000k -bufsize 8000k -f flv -listen 1 rtmp://localhost:4444/stream

    


    And finally to show the rtmp stream

    


    ffplay -fflags -nobuffer -flags low_delay -probesize 32 -flags low_delay -analyzeduration 0 -i rtmp://localhost:4444/stream

    


    The puppeteer script (index.js) which xfvb-runs

    


    

import puppeteer from 'puppeteer';
let initPuppeteer = async () => {
  const launchArgs = [
    //'--window-size=1280,1024',
    '--disable-web-security',
    '--disable-features=IsolateOrigins',
    '--disable-site-isolation-trials',
    '--app',
    '--kiosk',
  ]
  await puppeteer.launch({headless: false, ignoreDefaultArgs: ["--enable-automation"], args: launchArgs});
  const page = await this.browser.newPage();
  const device = puppeteer.devices['Nexus 10'];
  await page.emulate(device);
  await page.goto("https://google.com");
}
initPuppeteer()


    


  • Revision ba70f16011 : Add early termination in transform size search In the full-rd transform size se

    12 août 2014, par Yunqing Wang

    Changed Paths :
     Modify /vp9/encoder/vp9_rdopt.c


     Modify /vp9/encoder/vp9_speed_features.c


     Modify /vp9/encoder/vp9_speed_features.h



    Add early termination in transform size search

    In the full-rd transform size search, we go through all transform
    sizes to choose the one with best rd score. In this patch, an
    early termination is added to stop the search once we see that the
    smaller size won’t give better rd score than the larger size. Also,
    the search starts from largest transform size, then goes down to
    smallest size.

    A speed feature tx_size_search_breakout is added, which is turned off
    at speed 0, and on for other speeds. The transform size search is
    turned on at speed 1.

    Borg test results :
    1. At speed 1,
    derf set : psnr gain : 0.618%, ssim gain : 0.377% ;
    stdhd set : psnr gain : 0.594%, ssim gain : 0.162% ;
    No noticeable speed change.
    3. At speed 2,
    derf set : psnr loss : 0.157%, ssim loss : 0.175% ;
    stdhd set : psnr loss : 0.090%, ssim loss : 0.101% ;
    speed gain : 4%.

    Change-Id : I22535cd2017b5e54f2a62bb6a38231aea4268b3f