laravel-ffmpeg icon indicating copy to clipboard operation
laravel-ffmpeg copied to clipboard

Chained - Is there a way to optional / conditional execution

Open ibrainventures opened this issue 3 years ago • 0 comments

Hi, in a chained process list, is there a way to execute some exports/save parts with a conditional syntax?

As Example, in my chain i want to execute the second segment only if a condition (which is flagged outside the chain) is true.

(If not out-of-the-box possible, this is a Feature Request :-))

                ->export()
                ->toDisk($ffmpegToDisk)
                ->inFormat((new \FFMpeg\Format\Video\X264())->setAudioChannels(1)->setAudioKiloBitrate(64)->setKiloBitrate(0)->setPasses(1))
                ->resize($vidScaleTargetWidthNativeMedium, $vidScaleTargetHeightNativeMedium, $vidScaleTargetResizeModeNativeMedium, false)
                ->addFilter('-movflags', '+faststart')
                ->addFilter('-threads', $ffmpegThreads)
                ->addFilter('-crf', $VID_FFMPEG_CRF_CBR_NATIVE_MEDIUM)
                ->save($ffmpegSaveFullPathSubDirFilenameNoExtension . '-natf_med-new.mp4')
            // -natf_med-new.mp4 ENDE (gecleaneed) --------------------------------------

                ->export()
                ->toDisk($ffmpegToDisk)
                ->inFormat(new CopyFormat)
                ->addFilter('-movflags', '+faststart')
                ->addFilter('-threads', $ffmpegThreads)
                ->save($ffmpegSaveFullPathSubDirFilenameNoExtension . '-natf_med-copy.mp4')

            // tile exporter start -----------------------------------------------------------------
            //
                ->exportTile(function (TileFactory $factory) {
                    $factory->interval(5)
                        ->scale(320, 180)
                        ->grid(3, 5)
                        ->quality(2);
                })
                ->toDisk($ffmpegToDisk)
                ->save($ffmpegSaveFullPathSubDirFilenameNoExtension . '-' . 'tile_%05d.jpg')
            //

Thank you for this package.

ibrainventures avatar Aug 09 '22 15:08 ibrainventures