Recherche avancée

Médias (91)

Autres articles (70)

  • Use, discuss, criticize

    13 avril 2011, par

    Talk to people directly involved in MediaSPIP’s development, or to people around you who could use MediaSPIP to share, enhance or develop their creative projects.
    The bigger the community, the more MediaSPIP’s potential will be explored and the faster the software will evolve.
    A discussion list is available for all exchanges between users.

  • Gestion des droits de création et d’édition des objets

    8 février 2011, par

    Par défaut, beaucoup de fonctionnalités sont limitées aux administrateurs mais restent configurables indépendamment pour modifier leur statut minimal d’utilisation notamment : la rédaction de contenus sur le site modifiables dans la gestion des templates de formulaires ; l’ajout de notes aux articles ; l’ajout de légendes et d’annotations sur les images ;

  • Les tâches Cron régulières de la ferme

    1er décembre 2010, par

    La gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
    Le super Cron (gestion_mutu_super_cron)
    Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...)

Sur d’autres sites (10891)

  • Best way to have 2 youtube-dl input with ffmpeg and php

    8 janvier 2021, par Baraque Obahamas

    I'm trying to find the best way to combine a youtube-dl link in mp4 format with another youtube-dl link in m4a format to get an mp4 file through ffmpeg & php and to have an output in stdout in order to download the file directly.

    


    With only one file to convert to another format, I managed to do it easily, for example from m4a to mp3 :

    


    $cmd = "youtube-dl -f bestaudio[ext=m4a] --no-part --no-cache-dir --no-warnings --no-progress -o - https://www.youtube.com/watch?v=6Dh-RL__uN4 | ffmpeg -i - -f mp3 -ab 192k -";


    


    But with 2 inputs, it doesn't work :

    


    $cmd = "cat <(youtube-dl -f bestvideo[ext=mp4] --no-part --no-cache-dir --no-warnings --no-progress -o - https://www.youtube.com/watch?v=6Dh-RL__uN4) <(youtube-dl -f bestaudio[ext=m4a] --no-part --no-cache-dir --no-warnings --no-progress -o - https://www.youtube.com/watch?v=6Dh-RL__uN4) > ffmpeg -i - -movflags frag_keyframe+empty_moov+faststart -frag_duration 3600 -c:v copy -c:a copy -f mp4 -";


    


    In this case I get a "said into stderr : "sh : 1 : Syntax error : "(" unexpected")" error.

    


    I guess there must be a better way to do it.
I notice another problem is that on the ffmpeg command there is only one input "-i -". Now there are 2 inputs, there should be I guess "pipe:3" in addition, but so far my tests have not been conclusive.

    


    Full code :

    


    <?php
header('Content-Description: File Transfer');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header("Content-Disposition: attachment; filename=\"ok.mp4\"");
header("Content-Type: application/octet-stream");

$cmd = "cat <(youtube-dl -f bestvideo[ext=mp4] --no-part --no-cache-dir --no-warnings --no-progress -o - https://www.youtube.com/watch?v=6Dh-RL__uN4) <(youtube-dl -f bestaudio[ext=m4a] --no-part --no-cache-dir --no-warnings --no-progress -o - https://www.youtube.com/watch?v=6Dh-RL__uN4) > ffmpeg -i - -movflags frag_keyframe+empty_moov+faststart -frag_duration 3600 -c:v copy -c:a copy -f mp4 -";
$cmd = passthru($cmd, $status);


    


  • php. ffmpeg. read from input stream. How to ?

    3 décembre 2020, par rzlvmp

    I trying to create mp4 file from looping jpg image. By transfer jpg image as a stdin stream.

    


    $cwd = getcwd();
$env = [];
   
$descriptorspec = array(
    0 => ["pipe", "r"],  // stdin
    1 => ["pipe", "w"],  // stdout
    2 => ["pipe", "w"]   // stderr
);

$transcode_command = 'ffmpeg -y -f lavfi -i anullsrc=channel_layout=stereo:sample_rate=44100 -f jpeg_pipe -loop 1 -i pipe:0 -c:v libx264 -r 29.97 -t 30 -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2,setsar=1" -c:a aac -shortest -movflags faststart -f mp4 /tmp/output.mp4';
$process = proc_open($transcode_command, $descriptorspec, $pipes, $cwd, $env);

$s3_client = new Aws\S3\S3Client([
    'calculate_md5' => true,
    'region' => $REGION,
    'version' => 'latest',
    'credentials' => [
        'key'    => $AWS_KEY,
        'secret' => $AWS_SECRET
    ]
]);
$s3_client->registerStreamWrapper();

if (is_resource($process)) {

    $input_stream = fopen('s3://somebucket/image.jpg', 'r');

    if ($input_stream) {

        while (!feof($input_stream)) {
            fwrite($pipes[0], fread($input_stream, 1024));
            fclose($pipes[0]);
        }
        
        $output = stream_get_contents($pipes[1]);
        $error = stream_get_contents($pipes[2]);

        fclose($input_stream);
        fclose($pipes[1]);
        fclose($pipes[2]);

        print_r($output);
        print_r($error);
    }
}


    


    And I've get response

    


    ...
Input #0, lavfi, from 'anullsrc=channel_layout=stereo:sample_rate=44100':
  Duration: N/A, start: 0.000000, bitrate: 705 kb/s
    Stream #0:0: Audio: pcm_u8, 44100 Hz, stereo, u8, 705 kb/s
[mjpeg @ 0xa705a0] EOI missing, emulating
Input #1, jpeg_pipe, from 'pipe:0':
  Duration: N/A, bitrate: N/A
    Stream #1:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 200x200 [SAR 72:72 DAR 1:1], 25 tbr, 25 tbn, 25 tbc
Stream mapping:
  Stream #1:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
  Stream #0:0 -> #0:1 (pcm_u8 (native) -> aac (native))
[mjpeg @ 0xa70c40] overread 8
[mjpeg @ 0xa70c40] EOI missing, emulating
...


    


    Looks like ffmpeg don't wait for stream end (EOI missing, emulating) and trying to create output video after first while iteration. Resulting file is mp4 with one broken frame.
If I set chunk size (1024) bigger than image size, ffmpeg creates only one completed frame.

    


    ffmpeg command working pretty good if I use aws cli (see my answer). But when I try to send input stream via PHP ffmpeg failing.

    


    What problem may be ?..

    


  • FFmpeg - Save %{pts\:hms} in %variable% for saving as environment variable

    29 novembre 2020, par cmd_kevin

    After closing a video in ffplay I want that the last timestamp will saved as a value of an environment variable.

    


    To show the current timestamp in the playback window, I can use :

    


    ffplay -vf "drawtext=text='%{pts\:hms}'" input.mp4


    


    So there is a variable (%{pts\:hms}) for my purposes.

    


    To change the value of a variable (in my case %variable01%), I used :

    


    SET variable01=value


    


    To change the environment variable with %variable01%, I used : SETX environment_variable_01 %variable01%.

    


    My problem is that I can't use %{pts\:hms} to define %variable01% and echo %{pts\:hms} or SETX environment_variable_01 %{pts\:hms} didn't work.

    


    So I'm trying to transfer the %{pts\:hms} value to %variable01% but all of my attempts failed.

    


    What can I do to solve my problem ?

    


    I want this environment value to continue a video at the timestamp I closed ffplay and the command prompt.

    


    Edit1 : I have used search facility but I didn't find an answer, especially to this specific syntax with only one percent sign %{pts\:hms}.

    


    Here's my reproducible example :
ffplay -vf "drawtext=text='%{pts\:hms}'" input.mp4 & echo %{pts:hms}
Answer : %{pts\:hms}.

    


    I also tried :

    


    ffplay -vf "drawtext=text='%{pts\:hms}'" input.mp4 & SET variable01=%{pts\:hms}


    


    but the answer with

    


    echo %variable01%


    


    is

    


    %{pts\:hms}.


    


    Changing to %{pts\:hms}%didn't work too. The answer of echo is %{pts\:hms}%.