Search code examples
phplaravelffmpeg-php

How to return generated command string only when using PHP-FFMpeg libarary


How can I see which command string generated for below example code

$advancedMedia = $ffmpeg->openAdvanced(array('video_1.mp4', 'video_2.mp4'));
$advancedMedia->filters()
    ->custom('[0:v][1:v]', 'hstack', '[v]');
$advancedMedia
    ->map(array('0:a', '[v]'), new X264('aac', 'libx264'), 'output.mp4')
    ->save();

looking for toString() for FFMpeg class or https://github.com/protonemedia/laravel-ffmpeg libs


Solution

  • Apparently there's a method called getFinalCommand in the audio and video classes by the PHP-FFMpeg package.

    Access it via the get method:

    $advancedMedia
        ->get()
        ->getFinalCommand();
    

    Untested code.