Recherche avancée

Médias (1)

Mot : - Tags -/musée

Autres articles (44)

  • Pas question de marché, de cloud etc...

    10 avril 2011

    Le vocabulaire utilisé sur ce site essaie d’éviter toute référence à la mode qui fleurit allègrement
    sur le web 2.0 et dans les entreprises qui en vivent.
    Vous êtes donc invité à bannir l’utilisation des termes "Brand", "Cloud", "Marché" etc...
    Notre motivation est avant tout de créer un outil simple, accessible à pour tout le monde, favorisant
    le partage de créations sur Internet et permettant aux auteurs de garder une autonomie optimale.
    Aucun "contrat Gold ou Premium" n’est donc prévu, aucun (...)

  • Encoding and processing into web-friendly formats

    13 avril 2011, par

    MediaSPIP automatically converts uploaded files to internet-compatible formats.
    Video files are encoded in MP4, Ogv and WebM (supported by HTML5) and MP4 (supported by Flash).
    Audio files are encoded in MP3 and Ogg (supported by HTML5) and MP3 (supported by Flash).
    Where possible, text is analyzed in order to retrieve the data needed for search engine detection, and then exported as a series of image files.
    All uploaded files are stored online in their original format, so you can (...)

  • Amélioration de la version de base

    13 septembre 2013

    Jolie sélection multiple
    Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
    Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...)

Sur d’autres sites (7102)

  • what is the good function php to deal with ffmpeg and progress bar [duplicate]

    17 mai 2014, par Abed Soliman

    This question already has an answer here :

    I ask about ffmpeg and progressbar

    I used exec function with ffmpeg and output the result to txt file

    and using some of code I found here to

    <center>



       &lt;?php

       define('RAPIDLEECH', 'yes');
       define('CONFIG_DIR', 'configs/');
       require_once('configs/config.php');
       define ( 'TEMPLATE_DIR', 'templates/'.$options['template_used'].'/' );
       // Include other useful functions
       require_once('classes/other.php');
       error_reporting(0);

       login_check();

       include(TEMPLATE_DIR.'header.php');

       echo ('<br /><br /><br /><b>AudioXtractor</b>, un complemento <br /> que te permite extraer el audio de tus videos.<br /><br /><br />');

       putenv('GDFONTPATH=' . realpath('.')); ?>

       <br />

       <form method="post"><center>
       <table>
         <td>Movie:
       <select>

       &lt;?php
       $exts=array(".ac3", ".avi", ".f4v", ".flv", ".mkv", ".mov", ".mp4", ".mpg", ".mpeg", ".rmvb", ".srt", ".swf", ".wav", ".wmv");
       $ext="";
       function vidlist($dir)
       {
       $results = array();
       $handler = opendir($dir);
       while ($file = readdir($handler))
       {
       if (strrchr($file,'.')!="")
       {
       $ext=strtolower(strrchr($file,'.'));
       }
       if ($file != '.' &amp;&amp; $file != '..' &amp;&amp; in_array($ext,$GLOBALS["exts"]))
       {
       $results[] = $file;
       }
       }
       closedir($handler);
       sort($results);
       return $results;
       }
       function Output($command) {
       $output = array($command);
       exec($command.' 2>&amp;1', $output);
       return ($output);
       }
       $files = vidlist("./files/");
       foreach($files as $file)
       {
           echo '<option value="'.$file.'">'.$file.'</option>';
       }

       ?>


       </select></td></table>

       <br /> >
       New MP3's name:
       <input type="text" value="nuevoaudio" />
       <br /> >
       <br />
       <br />

       <center><input type="submit" style="font-size:16px; font-weight:bold; cursor:pointer;" value="Extract" />
       

       </center></center></form>


       &lt;?php
       if ($_POST['video']!="")

           $video = 'files/';
           $video=array();    
           $video[0] = $_POST['video'];

       if ($_POST['nvdo']!="")

           $nvdo = 'files/';
           $nvdo=array();      
           $nvdo[0] = $_POST['nvdo'];



       foreach ($video as $vdo)
       foreach ($nvdo as $nvd)

       if (isset($_POST["analize"])) {

           exec("ffmpeg -i files/$vdo -ab 192k files/$nvd.mp3 -y 2> files/$nvd.txt");

           $ext=strtolower(strrchr($vdo,'.'));

       /////////////////////////////////////////////////////my code //////////////////////////////////////////

       $content = @file_get_contents("files/$nvd.txt");


           //get duration of source
           preg_match("/Duration: (.*?), start:/", $content, $matches);

           $rawDuration = $matches[1];

           //rawDuration is in 00:00:00.00 format. This converts it to seconds.
           $ar = array_reverse(explode(":", $rawDuration));
           $duration = floatval($ar[0]);
           if (!empty($ar[1])) $duration += intval($ar[1]) * 60;
           if (!empty($ar[2])) $duration += intval($ar[2]) * 60 * 60;

           //get the time in the file that is already encoded
           preg_match_all("/time=(.*?) bitrate/", $content, $matches);

           $rawTime = array_pop($matches);

           //this is needed if there is more than one match
           if (is_array($rawTime)){$rawTime = array_pop($rawTime);}

           //rawTime is in 00:00:00.00 format. This converts it to seconds.
           $ar = array_reverse(explode(":", $rawTime));
           $time = floatval($ar[0]);
           if (!empty($ar[1])) $time += intval($ar[1]) * 60;
           if (!empty($ar[2])) $time += intval($ar[2]) * 60 * 60;

           //calculate the progress
           $progress = round(($time/$duration) * 100);




           echo '<br /><br />¡Su video fue convertido correctamente! <br /><br />Link al archivo:';

           echo ' <a href="http://stackoverflow.com/feeds/tag/files/'.$nvd.'.mp3">'.$nvd.'.mp3</a><br />' . "<br />";
           echo "Duration: " . $duration . "<br />";
           echo "Current Time: " . $time . "<br />";
           echo "Progress: " . $progress . "%" . "<br />";

       //////////////////////////////////////my coed //////////////////////////////////////////////
       }

       ?>
       <br /><br /><a href="http://stackoverflow.com/feeds/tag/index.php">Volver al RapidLeech</a>

       <br /><br /><br />Formatos Aceptados: <br /><b>.ac3, .avi, .f4v, .flv, .mkv, .mov, .mp3,<br /> .mp4, .mpg, .mpeg, .rmvb, .srt, .swf, .wav, .wmv</b>
       <br /><br />
       </center>

       &lt;?php



       ?>

    so i ask some one he told me the exec stop php script and never give me

    You can't get the progress directly if you are using exec, because the php script is stopped until ffmpeg closes. (Because exec returns the whole execution output)

    You should use popen, for being able to get the output from the process in real time (without reading any file) for parse and show the progressbar

    Here is a example for get the output:

    When you get the progress info from ffmpeg, you can use your code for parse it and show your progressbar

    this is my popen script

    &lt;?php

    $handle = popen ("ffmpeg.exe -i files/fz.mp4 -ab 192k files/vdf.mp3 2>&amp;1 ", 'r');
    $handles = (string)$handle;
    $line = "";

    while (false !== ($char = fgetc($handle)))
    {
     if ($char == "\r")
     {
       // You could now parse the $line for status information.
       echo "$line\n";
       $line = "";
     } else {
       $line .= $char;
     }
     ob_flush();
     flush();
    }
    pclose ($handle);


       //get duration of source
       preg_match("/Duration: (.*?), start:/", $handles, $matches);

       $rawDuration = $matches[1];

       //rawDuration is in 00:00:00.00 format. This converts it to seconds.
       $ar = array_reverse(explode(":", $rawDuration));
       $duration = floatval($ar[0]);
       if (!empty($ar[1])) $duration += intval($ar[1]) * 60;
       if (!empty($ar[2])) $duration += intval($ar[2]) * 60 * 60;

       //get the time in the file that is already encoded
       preg_match_all("/time=(.*?) bitrate/", $handles, $matches);

       $rawTime = array_pop($matches);

       //this is needed if there is more than one match
       if (is_array($rawTime)){$rawTime = array_pop($rawTime);}

       //rawTime is in 00:00:00.00 format. This converts it to seconds.
       $ar = array_reverse(explode(":", $rawTime));
       $time = floatval($ar[0]);
       if (!empty($ar[1])) $time += intval($ar[1]) * 60;
       if (!empty($ar[2])) $time += intval($ar[2]) * 60 * 60;

       //calculate the progress
       $progress = round(($time/$duration) * 100);




       echo '<br /><br />¡Su video fue convertido correctamente! <br /><br />Link al archivo:';


       echo "Duration: " . $duration . "<br />";
       echo "Current Time: " . $time . "<br />";
       echo "Progress: " . $progress . "%" . "<br />";

    //////////////////////////////////////my coed //////////////////////////////////////////////

    ?>

    so i dont under stand what is good for ffmpeg progressbAR

    is exec or popen

    so please give me hints for ffmpeg real time progressbar

    what is good for progressbar

    is html5 progress bar

    or javascript progress bar

  • Flutter : How to use "ffmpeg_kit_flutter" to merge videos ?

    28 mai 2024, par Hani Kanakri

    i am using "ffmpeg_kit_flutter" to merge two videos with code

    &#xA;

    &#xA;import &#x27;dart:io&#x27;;&#xA;&#xA;import &#x27;package:ffmpeg_kit_flutter/ffmpeg_kit.dart&#x27;;&#xA;import &#x27;package:ffmpeg_kit_flutter/abstract_session.dart&#x27;;&#xA;import &#x27;package:ffmpeg_kit_flutter/return_code.dart&#x27;;&#xA;import &#x27;package:flutter/material.dart&#x27;;&#xA;import &#x27;package:flutter_bloc/flutter_bloc.dart&#x27;;&#xA;import &#x27;package:wechat_assets_picker/wechat_assets_picker.dart&#x27;;&#xA;&#xA;import &#x27;/features/merge_videos/cubit/merge_videos_state.dart&#x27;;&#xA;&#xA;class MergeVideosCubit extends Cubit<mergevideosstate> {&#xA;  MergeVideosCubit(this.originalFile) : super(InitialMergeVideos());&#xA;  final File? originalFile;&#xA;&#xA;  Future<void> selectVideo(BuildContext context) async {&#xA;    final List<assetentity>? videos = await AssetPicker.pickAssets(&#xA;      context,&#xA;      pickerConfig: const AssetPickerConfig(requestType: RequestType.video),&#xA;    );&#xA;&#xA;    if (videos != null &amp;&amp; videos.isNotEmpty) {&#xA;      for (AssetEntity asset in videos) {&#xA;        File? videoFile = await asset.file;&#xA;        if (videoFile != null) {&#xA;          print(&#x27;Selected Asset Path: ${videoFile.path}&#x27;);&#xA;          mergeVideos(originalFile!.path, videoFile.path);&#xA;        }&#xA;      }&#xA;    }&#xA;  }&#xA;&#xA;  Future<void> mergeVideos(String inputPath1, String inputPath2) async {&#xA;    final String outputPath = "/storage/emulated/0/merged_video_${now()}.mp4";&#xA;    // final String command =&#xA;    //     &#x27;-i $inputPath1 -i $inputPath2 -filter_complex "[0:v][0:a][1:v][1:a] concat=n=2:v=1:a=1[outv][outa]" -map "[outv]" -map "[outa]" -y $outputPath&#x27;;&#xA;    final String command =&#xA;        &#x27;-i $inputPath1 -i $inputPath2 -filter_complex "[0:v][1:v]concat=n=2:v=1:a=0[outv]" -map "[outv]" -y $outputPath&#x27;;&#xA;    print("FFmpeg process starting with command: $command");&#xA;    print(command);&#xA;    print("LOADING LOADING LOADING LOADING LOADING LOADING LOADING MERGE");&#xA;    emit(LoadMergeVideos());&#xA;    await FFmpegKit.execute(command).then((value) async {&#xA;      await value.getDuration();&#xA;      var id = await value.getSessionId();&#xA;&#xA;      print(value);&#xA;      print(id);&#xA;      print(await value.getDuration());&#xA;    });&#xA;    await FFmpegKit.executeAsync(command, (session) async {&#xA;      final returnCode = await session.getReturnCode();&#xA;      await session.getSessionId();&#xA;      print(await session.getSessionId());&#xA;&#xA;      if (ReturnCode.isSuccess(returnCode)) {&#xA;        print("SUCCESS: Video merged successfully at $outputPath");&#xA;        print("SUCCESS SUCCESS SUCCESS SUCCESS SUCCESS SUCCESS MERGE");&#xA;        emit(SuccessMergeVideos());&#xA;&#xA;      } else if (ReturnCode.isCancel(returnCode)) {&#xA;        print("CANCELLED: Video merging was cancelled.");&#xA;        print("CANCEL CANCEL CANCEL CANCEL CANCEL CANCEL CANCEL MERGE");&#xA;        emit(CancelMergeVideos());&#xA;&#xA;      } else {&#xA;        print("ERROR: Failed to merge videos.");&#xA;        print("ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR MERGE");&#xA;        emit(ErrorMergeVideos());&#xA;&#xA;        final failLog = await session.getFailStackTrace();&#xA;&#xA;        print("FFmpeg Failure Log: $failLog");&#xA;      }&#xA;    });&#xA;  }&#xA;&#xA;  String now() {&#xA;    final DateTime now = DateTime.now();&#xA;    return "${now.year}${now.month}${now.day}_${now.hour}${now.minute}${now.second}";&#xA;  }&#xA;}&#xA;</void></assetentity></void></mergevideosstate>

    &#xA;

    The console when i run the code

    &#xA;

    &#xA;D/EGL_emulation(23858): app_time_stats: avg=2379.66ms min=5.87ms max=23160.09ms count=10&#xA;I/PhotoManager(23858): uri: content://media/external/file&#xA;I/PhotoManager(23858): projection: _display_name, _data, _id, title, bucket_id, bucket_display_name, width, height, orientation, date_added, date_modified, mime_type, datetaken, duration, media_type, relative_path&#xA;I/PhotoManager(23858): selection: _id = ?&#xA;I/PhotoManager(23858): selectionArgs: 1000000039&#xA;I/PhotoManager(23858): sortOrder: null&#xA;I/PhotoManager(23858): sql: _id = 1000000039&#xA;I/PhotoManager(23858): cursor count: 1&#xA;I/flutter (23858): Selected Asset Path: /storage/emulated/0/Movies/VID_20240512_115116.mp4&#xA;I/flutter (23858): FFmpeg process starting with command: -i /storage/emulated/0/Movies/VID_20240512_115128.mp4 -i /storage/emulated/0/Movies/VID_20240512_115116.mp4 -filter_complex "[0:v][1:v]concat=n=2:v=1:a=0[outv]" -map "[outv]" -y /storage/emulated/0/merged_video_2024513_122719.mp4&#xA;I/flutter (23858): -i /storage/emulated/0/Movies/VID_20240512_115128.mp4 -i /storage/emulated/0/Movies/VID_20240512_115116.mp4 -filter_complex "[0:v][1:v]concat=n=2:v=1:a=0[outv]" -map "[outv]" -y /storage/emulated/0/merged_video_2024513_122719.mp4&#xA;I/flutter (23858): LOADING LOADING LOADING LOADING LOADING LOADING LOADING MERGE&#xA;I/flutter (23858): Instance of &#x27;FFmpegSession&#x27;&#xA;I/flutter (23858): 1&#xA;I/flutter (23858): 246&#xA;I/flutter (23858): 2&#xA;I/flutter (23858): ERROR: Failed to merge videos.&#xA;I/flutter (23858): ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR MERGE&#xA;D/EGL_emulation(23858): app_time_stats: avg=87.27ms min=4.92ms max=319.92ms count=13&#xA;I/flutter (23858): FFmpeg Failure Log: null&#xA;

    &#xA;

    In "mergeVideos" function the "returnCode" it return value "1" when i look in the package code

    &#xA;

    getState() async {&#xA;    try {&#xA;      return _platform&#xA;          .abstractSessionGetState(this.getSessionId())&#xA;          .then((state) {&#xA;        switch (state) {&#xA;          case 0:&#xA;            return SessionState.created;&#xA;          case 1:&#xA;            return SessionState.running;&#xA;          case 2:&#xA;            return SessionState.failed;&#xA;          case 3:&#xA;          default:&#xA;            return SessionState.completed;&#xA;        }&#xA;      });&#xA;    } on PlatformException catch (e, stack) {&#xA;      print("Plugin getState error: ${e.message}");&#xA;      return Future.error("getState failed.", stack);&#xA;    }&#xA;}&#xA;

    &#xA;

    Which mean its keep running but in my code it does not wait until complete merging

    &#xA;

    how can i fix that ??!

    &#xA;

    but i think my problem is in command(concat)

    &#xA;

    &#xA;-i /storage/emulated/0/Movies/VID_20240512_115128.mp4 -i /storage/emulated/0/Movies/VID_20240512_115116.mp4 -filter_complex "[0:v][1:v]concat=n=2:v=1:a=0[outv]" -map "[outv]" -y /storage/emulated/0/merged_video_2024513_122719.mp4&#xA;

    &#xA;

    (This is my command when i run the code) ??

    &#xA;

  • Best way to record a HTML Canvas/WebGL animation server-side into a video ?

    14 décembre 2016, par Abhinav

    I have a set of animations which I can make in Canvas (fabric.js) or WebGL (three.js). I need to record them automatically, server-side, through a script and output a video file.

    The animations include :

    1. Pictures
    2. Videos (with audio)
    3. Other animations/effects

    I have researched a lot during last few months on this.

    Results
    1. User PhantomJS + FFMPEG
    Run HTML Canvas animations on headless browser(PhantomJS) and record with FFMPEG. Here the issue is PhantomJS supports neither WebGL nor Video element. http://phantomjs.org/supported-web-standards.html

    2. Use Websockets to send data back to server using DataURL
    Here again, we will need to run the animations on browser (which we can’t because we have to do everything on server).

    3. Use node-canvas
    This is a library by TJ Holowaychuk which allows rendering HTML Canvas on Node.js. But it has its own limitations plus I haven’t really explored this field much.
    (If someone could shed more light on this library)

    If anyone has done it before or can guide me somewhere useful.
    All we need to do is use some data to create animations and record it into a video, everything on server side.