Recherche avancée

Médias (2)

Mot : - Tags -/media

Autres articles (55)

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

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

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

Sur d’autres sites (7823)

  • How To Specify FFMPEG Input Volume For Multple Input Files

    30 septembre 2014, par gbd

    I have 6 similar/separate audio input files feeding into ffmpeg - no video. I’m mixing the 6 input channels down to a stereo output using amix and that works fine. But now I need to change the volume of each individual input channel before the mix down - or maybe as part of the mix down. I’ve looked at and tried aeval (which seems very slow) in the form

    'aeval=val(0)*volChg1:c=same|val(1)*volChg2:c=same|val(2)*volChg3:c=same|val(3)*volChg4:c=same|val(4)*volChg5:c=same|val(5)*volChg6:c=same'

    but that only seems to change the volume of the first channel.

    So the whole input part of my ffmpeg expression looks something like this right now :

    -i inFilePath1 -i inFilePath2 -i inFilePath3 -i inFilePath4 -i inFilePath5 -i inFilePath6
    -filter_complex 'aeval=val(0)*$volChg1:c=same|val(1)*$volChg2:c=same|val(2)*$volChg3:c=same|val(3)*$volChg4:c=same|val(4)*$volChg5:c=same|val(5)*$volChg6:c=same','amix=inputs=6:duration=longest'

    $volChg1-6 are php variables containing the individual volume multipliers - 0.5 for example should halve the volume of that individual channel while 1.0 would leave it unaffected. How do I do this ?

  • 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

  • Evolution #2633 : Pouvoir modifier _DIR_RESTREINT_ABS

    10 juillet 2015, par jluc -

    Si on enlève les répertoires de tests, il ne reste plus grand chose :

    // normal
    spip.php:14:if (!defined(’_DIR_RESTREINT_ABS’)) define(’_DIR_RESTREINT_ABS’, ’ecrire/’) ;
    ecrire/inc_version.php:38 :    define(’_DIR_RESTREINT_ABS’, ’ecrire/’) ;
    

    // pb ecrire
    ecrire/public/debusquer.php:366 : if ($reg[1]==’ecrire/public’)

    // dist
    plugins-dist/forum/prive/modeles/forum-actions-moderer.html:2 :[(#SETretour,[(#REM|test_espace_prive| ?[(#VALecrire/|concat#SELF|replace’./’,’’)],#SELF|ancre_urlforum#ID_FORUM)])]

    // installation ’normale’
    config/ecran_securite.php:113 : OR @file_exists(’ecrire/inc_version.php’))
    config/ecran_securite.php:259:if (strpos($_SERVER[’REQUEST_URI’],"ecrire/") !==false)

    spip_loader.php:44:define(’_SPIP_LOADER_PLUGIN_RETOUR’, "ecrire/ ?exec=admin_plugin&voir=tous") ;
    spip_loader.php:923:if (@file_exists(’ecrire/inc_version.php’))
    spip_loader.php:924 : define(’_SPIP_LOADER_URL_RETOUR’, "ecrire/ ?exec=accueil") ;
    spip_loader.php:925 : include_once ’ecrire/inc_version.php’ ;
    spip_loader.php:933 :
    else define(’_SPIP_LOADER_URL_RETOUR’, "ecrire/ ?exec=install") ;