Recherche avancée

Médias (91)

Autres articles (60)

  • 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 (...)

  • 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 (...)

  • Submit bugs and patches

    13 avril 2011

    Unfortunately a software is never perfect.
    If you think you have found a bug, report it using our ticket system. Please to help us to fix it by providing the following information : the browser you are using, including the exact version as precise an explanation as possible of the problem if possible, the steps taken resulting in the problem a link to the site / page in question
    If you think you have solved the bug, fill in a ticket and attach to it a corrective patch.
    You may also (...)

Sur d’autres sites (3656)

  • Launch Symfony 4 command from controller works on dev but not in prod environment

    14 août 2019, par JoakDA

    When an application loads, I make 2 AJAX request to start 2 proccess needed for showing a RTSP video streaming on the website.

    It is working great in DEV environment but making some tests in PROD, it only works if the page is loaded on the server webbrowser (same host where the application is installed).

    If I use an external browser installed on another machine, it doesn’t launch the video.

    If I use an external browser installed on another machine, it doesn’t launch the video.

    /**
    * Start transcoding video.
    * @param Request $request
    * @return Response
    * @Route("devices/show/videotranscoding", name="start_video_transcoding", methods={"POST"})
    * @IsGranted("ROLE_OPERATOR")
    */
    public function startTranscodingVideo(Request $request)
    {
       $value = '';
       try {
           //Setup needed variables
           $this->initialize();

           $this->logger->info('Start Video transcoding: Ok. Video started successfully');

           //Get device id from POST data
           $deviceid = $request->request->get('deviceid');

           //Find device to show from system
           $deviceToShow = $this->repository->find($deviceid);

           if ($deviceToShow) {
               $this->logger->info('Start Video transcoding: . Device has been found. Delete it... Data: ' . $deviceToShow->__toString());

               $realHost = $this->getRealHost($_SERVER['HTTP_HOST']);

               $tcpHost = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://{$realHost}";

               //Launch transcoding command
               $transcodingCommand = 'php ' . $this->getParameter('kernel.project_dir') . '/bin/console device:videotranscoding ' .
                   'rtsp://' . $deviceToShow->getUsername() . ':' . $deviceToShow->getPassword() . '@' . str_replace('http://', '', $deviceToShow->getHost()) . ':' . $deviceToShow->getRTSPPort() . ' ' .
                   str_replace(' ', '', $deviceToShow->getName()) . ' ' . $tcpHost . ' ' . $deviceToShow->getVideoHTTPPort();

               $transcodingProcess = \Symfony\Component\Process\Process::fromShellCommandline($transcodingCommand);

               $transcodingProcess->start();

               $success = true;
               $message = '';

           } else {
               $message = $this->translator->trans('Device with identifier %deviceid% was not found.',
                   ['%deviceid%' => $deviceid]);
               $success = false;

               $this->addFlash('error', $message);

               $this->logger->error('Start Video transcoding: Ko. Device with identifier ' . $deviceid . ' was not found.');
           }
       } catch (Throwable $exception) {
           $message = $this->translator->trans('Error while executing action. Error detail: %detail%.',
               ['%detail%' => $exception->getMessage()]);

           $this->addFlash(
               'error', $message
           );
           $success = false;

           $this->logger->critical('Start Video transcoding: Ko. Exception catched. Error detail: ' . $exception->getMessage());
       }

       $this->logger->info('Start Video transcoding: Ok. Video started successfully');

       return new JsonResponse(array(
           'success' => $success,
           'message' => $message,
           'value' => $value
       ));
    }

    I have a nodejs script executing in background to listen o a specific port to broadcast the data on the TCP port to a websocket server.

    The ffmpeg command transcodes the RTSP stream and sent to port TCP 8102 and broadcast the data to a websocket server listening on port 8105.

    The transcoding command code :

    /**
    * @param InputInterface $input
    * @param OutputInterface $output
    * @return int|void|null
    * @throws \Exception
    */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
       try {
           $this->logger->info('Start video transcoding: Setup video transcoding...');
           $io = new SymfonyStyle($input, $output);
           $now = new \DateTime();
           $io->title('Start video transcoding at ' . $now->format('d-m-Y G:i:s') . '...');

           //Get input parameters
           $rtspUri = $input->getArgument('rtsp');
           $secret = $input->getArgument('secret');
           $portsString = $input->getArgument('tcp_port');
           $tcpHost = $input->getArgument('tcp_host');

           $this->logger->debug('Start video transcoding: RTSP: "' . $rtspUri . '". TCP Port: ' . $portsString);

           //Absolute path to logs
           $logPath = $this->path . DIRECTORY_SEPARATOR . 'var' . DIRECTORY_SEPARATOR . 'log';
           $stdOutPath = $logPath . DIRECTORY_SEPARATOR . 'transcoding_out.log';
           $stdErrrorPath = $logPath . DIRECTORY_SEPARATOR . 'transcoding_error.log';

           //FFMPEG
           $arguments = '-nostdin -t 00:01:00 -rtsp_transport tcp -i ' . $rtspUri . ' -f mpegts -codec:v mpeg1video -s 1920x1080 -b:v 800k -r 30 -bf 0 ' . $tcpHost . ':' . $portsString . '/' . $secret . ' > '
           . $stdOutPath . ' 2> ' . $stdErrrorPath . ' &';
           $ffmpegParams = '/usr/bin/ffmpeg ' . $arguments;
           //$ffmpegProcess = new Process($ffmpegParams);
           $ffmpegProcess = \Symfony\Component\Process\Process::fromShellCommandline($ffmpegParams);
           $ffmpegProcess->setTimeout(60);
           $ffmpegProcess->setIdleTimeout(60);

           try {
               $ffmpegProcess->start();

               $this->logger->info('Start video transcoding: OK. Video streaming successfully started...');
               $io->success('Start video transcoding: OK. Video streaming successfully started...');
           }catch (ProcessTimedOutException $timedOutException){
               $ffmpegProcess->stop(3, SIGINT);
               $this->io->success('Start video transcoding: Ko. Transcoding finished with error.');
           }
       } catch (Throwable $exception) {
           $message = 'Start video transcoding: Ko. Exception catched. Error detail: ' . $exception->getMessage();
           $this->logger->critical($message);
           $io->error($message);
       }
    }

    The node.js code (got from here JSMpeg – MPEG1 Video & MP2 Audio Decoder in JavaScript :

    // Use the websocket-relay to serve a raw MPEG-TS over WebSockets. You can use
    // ffmpeg to feed the relay. ffmpeg -> websocket-relay -> browser
    // Example:
    // node websocket-relay yoursecret 8081 8082
    // ffmpeg -i <some input="input"> -f mpegts http://localhost:8081/yoursecret

    var fs = require('fs'),
       http = require('http'),
       WebSocket = require('ws');

    if (process.argv.length &lt; 3) {
       console.log(
           'Usage: \n' +
           'node websocket-relay.js <secret> [ ]'
       );

       console.log(process.cwd());

       process.exit();
    }

    var STREAM_SECRET = process.argv[2],
       STREAM_PORT = process.argv[3] || 8081,
       WEBSOCKET_PORT = process.argv[4] || 8082,
       RECORD_STREAM = false;

    // Websocket Server
    var socketServer = new WebSocket.Server({port: WEBSOCKET_PORT, perMessageDeflate: false});
    socketServer.connectionCount = 0;
    socketServer.on('connection', function(socket, upgradeReq) {
       socketServer.connectionCount++;
       console.log(
           'New WebSocket Connection: ',
           (upgradeReq || socket.upgradeReq).socket.remoteAddress,
           (upgradeReq || socket.upgradeReq).headers['user-agent'],
           '('+socketServer.connectionCount+' total)'
       );
       socket.on('close', function(code, message){
           socketServer.connectionCount--;
           console.log(
               'Disconnected WebSocket ('+socketServer.connectionCount+' total)'
           );
       });
    });
    socketServer.broadcast = function(data) {
       socketServer.clients.forEach(function each(client) {
           if (client.readyState === WebSocket.OPEN) {
               client.send(data);
           }
       });
    };

    // HTTP Server to accept incomming MPEG-TS Stream from ffmpeg
    var streamServer = http.createServer( function(request, response) {
       var params = request.url.substr(1).split('/');

       if (params[0] !== STREAM_SECRET) {
           console.log(
               'Failed Stream Connection: '+ request.socket.remoteAddress + ':' +
               request.socket.remotePort + ' - wrong secret.'
           );
           response.end();
       }

       response.connection.setTimeout(0);
       console.log(
           'Stream Connected: ' +
           request.socket.remoteAddress + ':' +
           request.socket.remotePort
       );
       request.on('data', function(data){
           socketServer.broadcast(data);
           if (request.socket.recording) {
               request.socket.recording.write(data);
           }
       });
       request.on('end',function(){
           console.log('close');
           if (request.socket.recording) {
               request.socket.recording.close();
           }
       });

       // Record the stream to a local file?
       if (RECORD_STREAM) {
           var path = 'recordings/' + Date.now() + '.ts';
           request.socket.recording = fs.createWriteStream(path);
       }
    }).listen(STREAM_PORT);

    console.log('Listening for incomming MPEG-TS Stream on http://127.0.0.1:'+STREAM_PORT+'/<secret>');
    console.log('Awaiting WebSocket connections on ws://127.0.0.1:'+WEBSOCKET_PORT+'/');
    </secret></secret></some>

    I am using PHP 7.3 and Symfony 4.3

    I am able to get a successfully response from the controller but I can’t watch the video streaming on an external computer.

    UPDATED : I don’t know if it may be related to the issue, but when I switch to DEV and then switch again to PROD using :

    composer dump-env prod

    If I try to clear the cache with :

    php bin/console cache:clear

    It appears :

    joaquin@dev-computer:/var/www/example.com/html$ composer dump-env prod
    Successfully dumped .env files in .env.local.php
    joaquin@dev-computer:/var/www/example.com/html$ php bin/console cache:clear
    09:15:07 ERROR     [console] Error thrown while running command "cache:clear". Message: "Failed to remove file "/var/www/example.com/html/var/cache/pro~/pools/WBCr1hDG8d/-/R/iW4Vq0vqfrjVsp2Gihwg": unlink(/var/www/example.com/html/var/cache/pro~/pools/WBCr1hDG8d/-/R/iW4Vq0vqfrjVsp2Gihwg): Permission denied." ["exception" => Symfony\Component\Filesystem\Exception\IOException]8;;file:///var/www/example.com/html/vendor/symfony/filesystem/Exception/IOException.php\^]8;;\ { …},"command" => "cache:clear","message" => "Failed to remove file "/var/www/example.com/html/var/cache/pro~/pools/WBCr1hDG8d/-/R/iW4Vq0vqfrjVsp2Gihwg": unlink(/var/www/example.com/html/var/cache/pro~/pools/WBCr1hDG8d/-/R/iW4Vq0vqfrjVsp2Gihwg): Permission denied."]

    In Filesystem.php line 184:

     Failed to remove file "/var/www/example.com/html/var/cache/pro~/pools/WBCr1hDG8d/-/R/iW4Vq0vqfrjVsp2Gihwg": unlink(/va  
    r/www/example.com/html/var/cache/pro~/pools/WBCr1hDG8d/-/R/iW4Vq0vqfrjVsp2Gihwg): Permission denied.                    


    cache:clear [--no-warmup] [--no-optional-warmers] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command>
    </command>

    Thanks

  • How can I pass chapter data to multiple streams with tee muxer

    11 février 2021, par jonnywishbone

    I'm trying to transcode several videos from their original format into 4K and 1080p HD MKV and/or MP4 containers. The original contains chapter info, but no matter how many incarnations of ffmpeg flags/settings I've tried, the chapter data doesn't wind up in either output stream.

    &#xA;

    Here's a redacted version of the command I'm using (PowerShell 7.1) :&#xA;...

    &#xA;

       ffmpeg -i "XXXXXxxxx.mkv" `&#xA;   -loglevel repeat&#x2B;warning -stats  -hide_banner -y -benchmark `&#xA;   -flags &#x2B;global_header -filter_complex `&#xA;   "[0:v]split=2[s0][s1]; `&#xA;   [s0]null[v2160]; [s1]scale=1920:-1[v1080]" `&#xA;   -to 00:01:05 -map "[v2160]" -map "[v1080]"  -map 0:1 -map_metadata 0 -map_chapters 0 -movflags use_metadata_tags `&#xA;   -c:v libx265  -x265-params  `&#xA;   "log-level=error" -pix_fmt yuv420p10le   `&#xA;  -b:v:0 3100K -b:v:1 2200K -minrate 400K -bufsize 8M  `&#xA;   -c:a:0 aac  -ac:a:0 2   -ar:a:0 48000 -af:a:0 dynaudnorm  -b:a:0 192k -disposition:a:0 default&#x2B;original `&#xA;   -metadata:s:a:0 language=eng -metadata:s:a:0 title="aac-stereo" -metadata:s:a:0 handler="aac-stereo" `&#xA;   -metadata comment=" "  -metadata title=""XXXXXxxxx"  `&#xA;   -f tee "[select=\&#x27;v:0,a\&#x27;:f=matroska]`""XXXXXxxxx [2160p].mkv`"|[select=\&#x27;v:1,a\&#x27;:f=matroska]`""XXXXXxxxx [1080p].mkv`""&#xA;

    &#xA;

    ...

    &#xA;

    What's the secret sauce for getting chapter info passed to the output streams ? Is it a tee select of some sort ? A different -map_metadata -type setting ?

    &#xA;

    Please forgive the odd code formatting - the editor really didn't know what to do with PowerShell back-tick escape characters that delimit quotes and other literals in PS scripting !

    &#xA;

  • Merge commit ’0508faaa11bf7507ffdd655aee57c9dc5a8203f4’

    29 mai 2015, par Michael Niedermayer
    Merge commit ’0508faaa11bf7507ffdd655aee57c9dc5a8203f4’
    

    * commit ’0508faaa11bf7507ffdd655aee57c9dc5a8203f4’ :
    rtmpdh : Pass the actual buffer size of the output secret key

    Merged-by : Michael Niedermayer <michaelni@gmx.at>

    • [DH] libavformat/rtmpcrypt.c
    • [DH] libavformat/rtmpdh.c
    • [DH] libavformat/rtmpdh.h