src/Service/Ffmpeg.php
public function convertToMp3($source, $target)
    {
        $this->serviceLocator->setShared('playgroundcore_phpvideotoolkit', false);
       
        $this->serviceLocator->get('playgroundcore_phpvideotoolkit')
            ->addPreInputCommand('-y')
            ->addCommand('-i', $source)
            ->addCommand('-vn')
            ->addCommand('-ar', '44100')
            ->addCommand('-ac', '2')
            ->addCommand('-ab', '192')
            ->addCommand('-f', 'mp3')
            ->setOutputPath($target)
            ->execute();
        
        return $target;
    }
public function convertToMp3($source, $target)
    {
        $this->serviceLocator->setShared('playgroundcore_phpvideotoolkit', false);
       
        $this->serviceLocator->get('playgroundcore_phpvideotoolkit')
            ->addPreInputCommand('-y')
            ->addCommand('-i', $source)
            ->addCommand('-vn')
            ->addCommand('-ar', '44100')
            ->addCommand('-ac', '2')
            ->addCommand('-ab', '192')
            ->addCommand('-f', 'mp3')
            ->setOutputPath($target)
            ->execute();
        
        return $target;
    }
public function convertToMp3 ( $ source , $ target ) { $ this -> serviceLocator -> setShared ( 'playgroundcore_phpvideotoolkit' , false ) ; $ this -> serviceLocator -> get ( 'playgroundcore_phpvideotoolkit' ) -> addPreInputCommand ( '-y' ) -> addCommand ( '-i' , $ source ) -> addCommand ( '-vn' ) -> addCommand ( '-ar' , '44100' ) -> addCommand ( '-ac' , '2' ) -> addCommand ( '-ab' , '192' ) -> addCommand ( '-f' , 'mp3' ) -> setOutputPath ( $ target ) -> execute ( ) ; return $ target ; }
ffmpeg -i sound.avi -vn -ar 44100 -ac 2 -ab 192 -f mp3 out.mp3
ffmpeg - i sound . avi - vn - ar 44100 - ac 2 - ab 192 - f mp3 out . mp3