Coder Social home page Coder Social logo

buggedcom / phpvideotoolkit-v2 Goto Github PK

View Code? Open in Web Editor NEW
260.0 260.0 86.0 24.71 MB

PHP Video Toolkit version 2 helps take the voodoo out of ffmpeg and provides a convenient object oriented wrapper around the ffmpeg programme.

License: Other

PHP 100.00%

phpvideotoolkit-v2's People

Contributors

bryant1410 avatar buggedcom avatar cassianotartari avatar heiglandreas avatar ivany4 avatar petewatts avatar rahii avatar ravetracer avatar samarrizvi avatar sapzxc avatar shmurakami avatar simonepozzobon avatar sonnb avatar tsmgeek avatar xboston avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

phpvideotoolkit-v2's Issues

Undefined offset: 2 in FfmpegParserAbstract.php:819

My users got this issue. It seems happens to some specific format only:

#0 /library/PHPVideoToolkit/FfmpegParserAbstract.php(819): XenForo_Application::handlePhpError(8, 'Undefined offse...', '/...', 819, Array)
#1 [internal function]: PHPVideoToolkit\FfmpegParserAbstract->getCommands()
#2 //library/PHPVideoToolkit/FfmpegParser.php(83): call_user_func_array(Array, Array)
#3 /library/PHPVideoToolkit/Format.php(122): PHPVideoToolkit\FfmpegParser->__call('getCommands', Array)
#4 /library/PHPVideoToolkit/Format.php(122): PHPVideoToolkit\FfmpegParser->getCommands()
#5 /library/PHPVideoToolkit/AudioFormat.php(52): PHPVideoToolkit\Format->__construct('input', Object(PHPVideoToolkit\Config))
#6 b/library/PHPVideoToolkit/VideoFormat.php(61): PHPVideoToolkit\AudioFormat->__construct('input', Object(PHPVideoToolkit\Config))
#7 /library/PHPVideoToolkit/Media.php(226): PHPVideoToolkit\VideoFormat->__construct('input', Object(PHPVideoToolkit\Config))
#8 /library/PHPVideoToolkit/Media.php(188): PHPVideoToolkit\Media->_getDefaultFormat('input', 'VideoFormat', NULL)
#9 /library/PHPVideoToolkit/Media.php(150): PHPVideoToolkit\Media->getDefaultFormat('input', NULL)
#10 /library/PHPVideoToolkit/Media.php(78): PHPVideoToolkit\Media->setInputFormat(NULL)
#11 /library/PHPVideoToolkit/Video.php(35): PHPVideoToolkit\Media->__construct('/tmp/phpuIYSkD', Object(PHPVideoToolkit\Config), NULL)

SAR/DAR output from probe does not match MediaParser.php regex

I have seen two different outputs which cause the probe to not match the regex to find the PAR & DAR.
Below you can see that the second array does not have square brackets around the SAR/DAR.

Changing the regex so that the square brackets are optional fixes this.

Not sure if this is a ffmpeg problem, I am on 2.4.3 but the two formats both happen within the same version.

Array
(
    [0] => Stream #0:1[0x1e0]: Video: mpeg2video (Main), yuv420p(tv), 720x480 [SAR 32:27 DAR 16:9], max. 9400 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    [1] =>  #0:1[0x1e0]
    [2] => mpeg2video (Main), yuv420p(tv), 720x480 [SAR 32:27 DAR 16:9], max. 9400 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
)
Array
(
    [0] => Stream #0:1(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, smpte170m), 720x480, 11449 kb/s, SAR 10:11 DAR 15:11, 29.97 fps, 29.97 tbr, 2997 tbn, 5994 tbc (default)
    [1] =>  #0:1(eng)
    [2] => h264 (Main) (avc1 / 0x31637661), yuv420p(tv, smpte170m), 720x480, 11449 kb/s, SAR 10:11 DAR 15:11, 29.97 fps, 29.97 tbr, 2997 tbn, 5994 tbc (default)
)

Execution Error: PHPVideoToolkit\/VideoFormat\/Mp4.php line: 41 Trying to get property of non-object

Yeah this happens when I try to do the following:

$video = new PHPVideoToolkit\Video($tmpName);
$output_format = new PHPVideoToolkit\VideoFormat_Mp4();
$video->save($name.".mp4", $output_format);

A look at the faulty file reveals:

if($config->force_enable_qtfaststart === true)

So maybe you should actually check the presence of "force_enable_qtfaststart":

 if(isset($config->force_enable_qtfaststart) && $config->force_enable_qtfaststart === true)

And when I correct this, I get the next error:

PHP Fatal error: Uncaught exception 'LogicException' with message 'The command "-ss" has already been given and it cannot be repeated. If you wish to allow a repeating command, set $allow_command_repetition to true.'

Hmm do I do something wrong here, or is the current version just this buggy? Seems like nothing is working correctly?

Can't inherit abstract function CacheInterface::isAvailable()

Hello,

Without define any cache_driver, one of my users get this issue while processing the video:
Fatal Error: Can't inherit abstract function PHPVideoToolkit\CacheInterface::isAvailable() (previously declared abstract in PHPVideoToolkit\CacheAbstract) - library/PHPVideoToolkit/CacheAbstract.php:22

Unable to set audio codec to libfdk_aac using setAudioCodec()

When trying to change audio codec to libfdk_aac you get an exception.
I suspect it is due to the way the toolkit finds out what codecs the system can accept.

Output from ffmpeg, as you can see on the aac line it shows the different enc/decoders in the description.

[console]# ../tools/ffmpeg -codecs|grep aac
ffmpeg version 2.4.3 Copyright (c) 2000-2014 the FFmpeg developers
  built on Nov 24 2014 15:04:17 with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-4)
  configuration: --prefix=/root/ffmpeg_build --extra-cflags=-I/root/ffmpeg_build/include --extra-ldflags=-L/root/ffmpeg_build/lib --bindir=/root/bin --enable-gpl --enable-nonfree --enable-libfdk_aac --enable-libmp3lame --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libfreetype
  libavutil      54.  7.100 / 54.  7.100
  libavcodec     56.  1.100 / 56.  1.100
  libavformat    56.  4.101 / 56.  4.101
  libavdevice    56.  0.100 / 56.  0.100
  libavfilter     5.  1.100 /  5.  1.100
  libswscale      3.  0.100 /  3.  0.100
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  0.100 / 53.  0.100
 DEA.L. aac                  AAC (Advanced Audio Coding) (decoders: aac libfdk_aac ) (encoders: aac libfdk_aac )
 D.A.L. aac_latm             AAC LATM (Advanced Audio Coding LATM syntax)

PHP Video Toolkit Example Codes

phpvideotoolkit-v2 is an awesome ffmpeg library, and I intend to use it for my web application. After modified the config file, I am going through the example codes to learn how to use the API. However, I could not get the code to work. when run convert-to-mp3.php, I got the following error. Please point me to the right direction.
Any help would be very appreciated.
I am on Windows 7 and I am running XAMPP.

Error
PHPVideoToolkit\FfmpegProcessException Object
(
[process:protected] => PHPVideoToolkit\FfmpegProcess Object
(
[_exec:protected] => PHPVideoToolkit\ExecBuffer Object
(
[_failure_tracking:protected] => 1
[_blocking:protected] => 1
[_output:protected] =>
[_temp_directory:protected] => E:\tmp
[_executed_command:protected] => ((C:\FFmpeg\bin\ffmpeg.EXE "-i" "C:\xampp\htdocs\www\webedu.local\video\examples\media\big_buck_bunny.mp4" && echo "") || echo "" "" ""$?) 2>&1 > "E:\tmp\php4EE4.tmp" 2>&1 &
[_command:protected] => C:\FFmpeg\bin\ffmpeg.EXE "-i" "C:\xampp\htdocs\www\webedu.local\video\examples\media\big_buck_bunny.mp4"
[_buffer:protected] => ffmpeg version N-54036-g6c4516d Copyright (c) 2000-2013 the FFmpeg developers
built on Jun 15 2013 12:59:09 with gcc 4.7.3 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
libavutil 52. 35.101 / 52. 35.101
libavcodec 55. 16.100 / 55. 16.100
libavformat 55. 8.102 / 55. 8.102
libavdevice 55. 2.100 / 55. 2.100
libavfilter 3. 77.101 / 3. 77.101
libswscale 2. 3.100 / 2. 3.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 3.100 / 52. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C:\xampp\htdocs\www\webedu.local\video\examples\media\big_buck_bunny.mp4':
Metadata:
major_brand : isom
minor_version : 0
compatible_brands: isom3gp4
creation_time : 2013-01-15 23:30:02
Duration: 00:00:20.40, start: 0.000000, bitrate: 8877 kb/s
Stream #0:0(eng): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p, 1280x720, 8969 kb/s, SAR 1:1 DAR 16:9, 22.42 fps, 28.67 tbr, 90k tbn, 180k tbc
Metadata:
rotate : 180
creation_time : 2013-01-15 23:30:02
handler_name : VideoHandle
Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 123 kb/s
Metadata:
creation_time : 2013-01-15 23:30:02
handler_name : SoundHandle
At least one output file must be specified
"" "" ""$?

                [_error_code:protected] => 0
                [_running:protected] => 
                [_start_time:protected] => 1374556372.3552
                [_end_time:protected] => 1374556372.4795
                [_callback_period_interval:protected] => 1
                [_boundary:protected] => 176766-51ee10d45693f-5d286afb15586c5b625c2c0e972c0aab
                [_failure_boundary:protected] => <f-176766-51ee10d45693f-5d286afb15586c5b625c2c0e972c0aab>
                [_completion_boundary:protected] => <c-176766-51ee10d45693f-5d286afb15586c5b625c2c0e972c0aab>
                [_error_code_boundary:protected] => <e-176766-51ee10d45693f-5d286afb15586c5b625c2c0e972c0aab>
                [_tmp_files:protected] => Array
                    (
                        [0] => E:\tmp\php4EE4.tmp
                    )

            )

        [_pre_input_commands:protected] => Array
            (
            )

        [_post_input_commands:protected] => Array
            (
            )

        [_post_output_commands:protected] => Array
            (
            )

        [_input:protected] => Array
            (
                [0] => C:\xampp\htdocs\www\webedu.local\video\examples\media\big_buck_bunny.mp4
            )

        [_output:protected] => 
        [_non_blocking:protected] => 
        [_progress_handler:protected] => 
        [_detect_error:protected] => 
        [_combined:protected] => 1
        [_program_path:protected] => C:\FFmpeg\bin\ffmpeg.EXE
        [_arguments:protected] => Array
            (
                [0] => -i
                [1] => C:\xampp\htdocs\www\webedu.local\video\examples\media\big_buck_bunny.mp4
            )

        [_config] => PHPVideoToolkit\Config Object
            (
                [_ffmpeg:protected] => C:\FFmpeg\bin\ffmpeg.EXE
                [_ffprobe:protected] => C:\FFmpeg\bin\ffprobe.EXE
                [_yamdi:protected] => C:\yamdi\bin\yamdi.EXE
                [_temp_directory:protected] => E:\tmp
                [_qtfaststart:protected] => C:\qtfaststart\bin\qt-faststart.EXE
                [_gif_transcoder:protected] => php
                [_gifsicle:protected] => C:\gifsicle\bin\gifsicle.EXE
                [_convert:protected] => C:\Program Files (x86)\ImageMagick-6.8.6-Q16\convert.EXE
            )

    )

[exec:protected] => 
[message:protected] => FFmpeg encountered an error when attempting to read `C:\xampp\htdocs\www\webedu.local\video\examples\media\big_buck_bunny.mp4`. FFmpeg reported: "" "" "<e-176766-51ee10d45693f-5d286afb15586c5b625c2c0e972c0aab>"$?
[string:Exception:private] => 
[code:protected] => 0
[file:protected] => C:\xampp\htdocs\www\webedu.local\video\lib\MediaParser.php
[line:protected] => 650
[trace:Exception:private] => Array
    (
        [0] => Array
            (
                [file] => C:\xampp\htdocs\www\webedu.local\video\lib\MediaParser.php
                [line] => 215
                [function] => getFileRawInformation
                [class] => PHPVideoToolkit\MediaParser
                [type] => ->
                [args] => Array
                    (
                        [0] => C:\xampp\htdocs\www\webedu.local\video\examples\media\big_buck_bunny.mp4
                        [1] => 1
                    )

            )

        [1] => Array
            (
                [file] => C:\xampp\htdocs\www\webedu.local\video\lib\Media.php
                [line] => 1098
                [function] => getFileType
                [class] => PHPVideoToolkit\MediaParser
                [type] => ->
                [args] => Array
                    (
                        [0] => C:\xampp\htdocs\www\webedu.local\video\examples\media\big_buck_bunny.mp4
                        [1] => 1
                    )

            )

        [2] => Array
            (
                [file] => C:\xampp\htdocs\www\webedu.local\video\lib\Media.php
                [line] => 121
                [function] => readType
                [class] => PHPVideoToolkit\Media
                [type] => ->
                [args] => Array
                    (
                    )

            )

        [3] => Array
            (
                [file] => C:\xampp\htdocs\www\webedu.local\video\lib\Video.php
                [line] => 38
                [function] => _validateMedia
                [class] => PHPVideoToolkit\Media
                [type] => ->
                [args] => Array
                    (
                        [0] => video
                    )

            )

        [4] => Array
            (
                [file] => C:\xampp\htdocs\www\webedu.local\video\examples\convert-to-mp3.php
                [line] => 7
                [function] => __construct
                [class] => PHPVideoToolkit\Video
                [type] => ->
                [args] => Array
                    (
                        [0] => media/big_buck_bunny.mp4
                        [1] => PHPVideoToolkit\Config Object
                            (
                                [_ffmpeg:protected] => C:\FFmpeg\bin\ffmpeg.EXE
                                [_ffprobe:protected] => C:\FFmpeg\bin\ffprobe.EXE
                                [_yamdi:protected] => C:\yamdi\bin\yamdi.EXE
                                [_temp_directory:protected] => E:\tmp
                                [_qtfaststart:protected] => C:\qtfaststart\bin\qt-faststart.EXE
                                [_gif_transcoder:protected] => php
                                [_gifsicle:protected] => C:\gifsicle\bin\gifsicle.EXE
                                [_convert:protected] => C:\Program Files (x86)\ImageMagick-6.8.6-Q16\convert.EXE
                            )

                    )

            )

    )

[previous:Exception:private] => 

)

av_interleaved_write_frame(): Invalid argument

Hello,
I have a problem with extracting frames from video file.
I set a new video file, call function extractFrames, but allways I have only one picture. Could anyone help me, please?

If I try to use code to Export a series of frames from documentation, I got this:

[hide] (1) Debugging \test.php on line 14 @ 27/05/2015 00:32:21: 
PHPVideoToolkit\FfmpegProcessProgressable Object
(
    [_progress_callbacks:PHPVideoToolkit\FfmpegProcessProgressable:private] => Array
        (
        )

    [_exec:protected] => PHPVideoToolkit\ExecBuffer Object
        (
            [_failure_tracking:protected] => 1
            [_blocking:protected] => 1
            [_output:protected] => 
            [_temp_directory:protected] => C:\xampp\htdocs\web\tmp
            [_executed_command:protected] => ((C:\ffmpeg\bin\ffmpeg.exe "-ss" "00:00:25.00" "-i" "C:\xampp\htdocs\web\VIDEO_TOOLKIT\examples\media\BigBuckBunny_320x180.mp4" "-y" "-ss" "00:00:15.00" "-t" "10" "-qscale" "4" "-strict" "experimental" "-threads" "1" "-an" "C:\xampp\htdocs\web\output\big_buck_bunny_frame_. 12d.24_40._t.._u.26880_bjho0_1432679541.u_.jpg" && echo ^<c-356530-5564f4750399f-9517f861642149b17d59f073b4672978^>) || echo ^<f-356530-5564f4750399f-9517f861642149b17d59f073b4672978^> ^<c-356530-5564f4750399f-9517f861642149b17d59f073b4672978^> ^<e-356530-5564f4750399f-9517f861642149b17d59f073b4672978^>) 2>&1 > "C:\xampp\htdocs\web\tmp\phpA3C.tmp" 2>&1 &
            [_command:protected] => C:\ffmpeg\bin\ffmpeg.exe "-ss" "00:00:25.00" "-i" "C:\xampp\htdocs\web\VIDEO_TOOLKIT\examples\media\BigBuckBunny_320x180.mp4" "-y" "-ss" "00:00:15.00" "-t" "10" "-qscale" "4" "-strict" "experimental" "-threads" "1" "-an" "C:\xampp\htdocs\web\output\big_buck_bunny_frame_. 12d.24_40._t.._u.26880_bjho0_1432679541.u_.jpg"
            [_buffer:protected] => ffmpeg version 1.1.3 Copyright (c) 2000-2013 the FFmpeg developers
  built on Mar  3 2013 02:02:22 with gcc 4.7.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52. 13.100 / 52. 13.100
  libavcodec     54. 86.100 / 54. 86.100
  libavformat    54. 59.106 / 54. 59.106
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 32.100 /  3. 32.100
  libswscale      2.  1.103 /  2.  1.103
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C:\xampp\htdocs\web\VIDEO_TOOLKIT\examples\media\BigBuckBunny_320x180.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: mp41
    creation_time   : 1970-01-01 00:00:00
    title           : Big Buck Bunny
    artist          : Blender Foundation
    composer        : Blender Foundation
    date            : 2008
    encoder         : Lavf52.14.0
  Duration: 00:09:56.46, start: 0.000000, bitrate: 867 kb/s
    Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 320x180 [SAR 1:1 DAR 16:9], 702 kb/s, 24 fps, 24 tbr, 24 tbn, 48 tbc
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 159 kb/s
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : SoundHandler
Please use -q:a or -q:v, -qscale is ambiguous
Output #0, image2, to 'C:\xampp\htdocs\web\output\big_buck_bunny_frame_. 12d.24_40._t.._u.26880_bjho0_1432679541.u_.jpg':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: mp41
    date            : 2008
    title           : Big Buck Bunny
    artist          : Blender Foundation
    composer        : Blender Foundation
    encoder         : Lavf54.59.106
    Stream #0:0(und): Video: mjpeg, yuvj420p, 320x180 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 90k tbn, 24 tbc
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : VideoHandler
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> mjpeg)
Press [q] to stop, [?] for help
[image2 @ 00000000023f7360] Could not get frame filename number 2 from pattern 'C:\xampp\htdocs\web\output\big_buck_bunny_frame_. 12d.24_40._t.._u.26880_bjho0_1432679541.u_.jpg' (either set updatefirst or use a pattern like %03d within the filename pattern)
av_interleaved_write_frame(): Invalid argument
<f-356530-5564f4750399f-9517f861642149b17d59f073b4672978> <c-356530-5564f4750399f-9517f861642149b17d59f073b4672978> <e-356530-5564f4750399f-9517f861642149b17d59f073b4672978>

            [_error_code:protected] => 0
            [_running:protected] => 
            [_start_time:protected] => 1432679541.0168
            [_end_time:protected] => 1432679541.4288
            [_callback_period_interval:protected] => 1
            [_boundary:protected] => 356530-5564f4750399f-9517f861642149b17d59f073b4672978
            [_failure_boundary:protected] => <f-356530-5564f4750399f-9517f861642149b17d59f073b4672978>
            [_completion_boundary:protected] => <c-356530-5564f4750399f-9517f861642149b17d59f073b4672978>
            [_error_code_boundary:protected] => <e-356530-5564f4750399f-9517f861642149b17d59f073b4672978>
            [_php_exec_infinite_timelimit:protected] => 1
            [_tmp_files:protected] => Array
                (
                    [0] => C:\xampp\htdocs\web\tmp\phpA3C.tmp
                )

        )

    [_pre_input_commands:protected] => Array
        (
            [-ss] => 00:00:25.00
        )

    [_post_input_commands:protected] => Array
        (
            [-y] => 
            [-ss] => 00:00:15.00
            [-t] => 10
        )

    [_post_output_commands:protected] => Array
        (
        )

    [_input:protected] => Array
        (
            [0] => C:\xampp\htdocs\web\VIDEO_TOOLKIT\examples\media\BigBuckBunny_320x180.mp4
        )

    [_output:protected] => C:\xampp\htdocs\web\output\big_buck_bunny_frame_.%12d.24_40._t.._u.26880_bjho0_1432679541.u_.jpg
    [_progress_handler:protected] => 
    [_detect_error:protected] => 
    [_combined:protected] => 1
    [_program_path:protected] => C:\ffmpeg\bin\ffmpeg.exe
    [_arguments:protected] => Array
        (
            [0] => -ss
            [1] => 00:00:25.00
            [2] => -i
            [3] => C:\xampp\htdocs\web\VIDEO_TOOLKIT\examples\media\BigBuckBunny_320x180.mp4
            [4] => -y
            [5] => -ss
            [6] => 00:00:15.00
            [7] => -t
            [8] => 10
            [9] => -qscale
            [10] => 4
            [11] => -strict
            [12] => experimental
            [13] => -threads
            [14] => 1
            [15] => -an
            [16] => C:\xampp\htdocs\web\output\big_buck_bunny_frame_.%12d.24_40._t.._u.26880_bjho0_1432679541.u_.jpg
        )

    [_config] => PHPVideoToolkit\Config Object
        (
            [_ffmpeg:protected] => C:\ffmpeg\bin\ffmpeg.exe
            [_ffprobe:protected] => C:\ffmpeg\bin\ffprobe.exe
            [_yamdi:protected] => C:\ffmpeg\bin\yamdi.exe
            [_qtfaststart:protected] => C:\ffmpeg\bin\qt-faststart.exe
            [_temp_directory:protected] => C:\xampp\htdocs\web\tmp
            [_gif_transcoder:protected] => 
            [_gifsicle:protected] => 
            [_convert:protected] => 
            [_php_exec_infinite_timelimit:protected] => 1
            [_force_enable_qtfaststart:protected] => 
            [_force_enable_flv_meta:protected] => 1
        )

)

Executed Command

[hide] (2) Debugging \test.php on line 18 @ 27/05/2015 00:32:21: 
C:\ffmpeg\bin\ffmpeg.exe "-ss" "00:00:25.00" "-i" "C:\xampp\htdocs\web\VIDEO_TOOLKIT\examples\media\BigBuckBunny_320x180.mp4" "-y" "-ss" "00:00:15.00" "-t" "10" "-qscale" "4" "-strict" "experimental" "-threads" "1" "-an" "C:\xampp\htdocs\web\output\big_buck_bunny_frame_. 12d.24_40._t.._u.26880_bjho0_1432679541.u_.jpg"

FFmpeg Process Messages

[hide] (3) Debugging \test.php on line 20 @ 27/05/2015 00:32:21: 
Array
(
)

Buffer Output

[hide] (4) Debugging \test.php on line 22 @ 27/05/2015 00:32:21: 
ffmpeg version 1.1.3 Copyright (c) 2000-2013 the FFmpeg developers
  built on Mar  3 2013 02:02:22 with gcc 4.7.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52. 13.100 / 52. 13.100
  libavcodec     54. 86.100 / 54. 86.100
  libavformat    54. 59.106 / 54. 59.106
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 32.100 /  3. 32.100
  libswscale      2.  1.103 /  2.  1.103
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C:\xampp\htdocs\web\VIDEO_TOOLKIT\examples\media\BigBuckBunny_320x180.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: mp41
    creation_time   : 1970-01-01 00:00:00
    title           : Big Buck Bunny
    artist          : Blender Foundation
    composer        : Blender Foundation
    date            : 2008
    encoder         : Lavf52.14.0
  Duration: 00:09:56.46, start: 0.000000, bitrate: 867 kb/s
    Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 320x180 [SAR 1:1 DAR 16:9], 702 kb/s, 24 fps, 24 tbr, 24 tbn, 48 tbc
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 159 kb/s
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : SoundHandler
Please use -q:a or -q:v, -qscale is ambiguous
Output #0, image2, to 'C:\xampp\htdocs\web\output\big_buck_bunny_frame_. 12d.24_40._t.._u.26880_bjho0_1432679541.u_.jpg':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: mp41
    date            : 2008
    title           : Big Buck Bunny
    artist          : Blender Foundation
    composer        : Blender Foundation
    encoder         : Lavf54.59.106
    Stream #0:0(und): Video: mjpeg, yuvj420p, 320x180 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 90k tbn, 24 tbc
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : VideoHandler
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> mjpeg)
Press [q] to stop, [?] for help
[image2 @ 00000000023f7360] Could not get frame filename number 2 from pattern 'C:\xampp\htdocs\web\output\big_buck_bunny_frame_. 12d.24_40._t.._u.26880_bjho0_1432679541.u_.jpg' (either set updatefirst or use a pattern like %03d within the filename pattern)
av_interleaved_write_frame(): Invalid argument
<f-356530-5564f4750399f-9517f861642149b17d59f073b4672978> <c-356530-5564f4750399f-9517f861642149b17d59f073b4672978> <e-356530-5564f4750399f-9517f861642149b17d59f073b4672978>

Resulting Output
Error

[hide] (5) Debugging \test.php on line 40 @ 27/05/2015 00:32:21: 
PHPVideoToolkit\FfmpegProcessOutputException Object
(
    [process:protected] => 
    [exec:protected] => 
    [message:protected] => Encoding failed and an error was returned from ffmpeg. Error code  was returned the message (if any) was: av_interleaved_write_frame(): Invalid argument
    [string:Exception:private] => 
    [code:protected] => 0
    [file:protected] => C:\xampp\htdocs\web\src\PHPVideoToolkit\FfmpegProcessProgressable.php
    [line:protected] => 208
    [trace:Exception:private] => Array
        (
            [0] => Array
                (
                    [file] => C:\xampp\htdocs\web\test.php
                    [line] => 25
                    [function] => getOutput
                    [class] => PHPVideoToolkit\FfmpegProcessProgressable
                    [type] => ->
                    [args] => Array
                        (
                        )

                )

        )

    [previous:Exception:private] => 
)
Executed Command

[hide] (6) Debugging \test.php on line 46 @ 27/05/2015 00:32:21: 
C:\ffmpeg\bin\ffmpeg.exe "-ss" "00:00:25.00" "-i" "C:\xampp\htdocs\web\VIDEO_TOOLKIT\examples\media\BigBuckBunny_320x180.mp4" "-y" "-ss" "00:00:15.00" "-t" "10" "-qscale" "4" "-strict" "experimental" "-threads" "1" "-an" "C:\xampp\htdocs\web\output\big_buck_bunny_frame_. 12d.24_40._t.._u.26880_bjho0_1432679541.u_.jpg"
FFmpeg Process Messages

[hide] (7) Debugging \test.php on line 48 @ 27/05/2015 00:32:21: 
Array
(
)
Buffer Output

[hide] (8) Debugging \test.php on line 50 @ 27/05/2015 00:32:21: 
ffmpeg version 1.1.3 Copyright (c) 2000-2013 the FFmpeg developers
  built on Mar  3 2013 02:02:22 with gcc 4.7.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52. 13.100 / 52. 13.100
  libavcodec     54. 86.100 / 54. 86.100
  libavformat    54. 59.106 / 54. 59.106
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 32.100 /  3. 32.100
  libswscale      2.  1.103 /  2.  1.103
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C:\xampp\htdocs\web\VIDEO_TOOLKIT\examples\media\BigBuckBunny_320x180.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: mp41
    creation_time   : 1970-01-01 00:00:00
    title           : Big Buck Bunny
    artist          : Blender Foundation
    composer        : Blender Foundation
    date            : 2008
    encoder         : Lavf52.14.0
  Duration: 00:09:56.46, start: 0.000000, bitrate: 867 kb/s
    Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 320x180 [SAR 1:1 DAR 16:9], 702 kb/s, 24 fps, 24 tbr, 24 tbn, 48 tbc
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 159 kb/s
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : SoundHandler
Please use -q:a or -q:v, -qscale is ambiguous
Output #0, image2, to 'C:\xampp\htdocs\web\output\big_buck_bunny_frame_. 12d.24_40._t.._u.26880_bjho0_1432679541.u_.jpg':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: mp41
    date            : 2008
    title           : Big Buck Bunny
    artist          : Blender Foundation
    composer        : Blender Foundation
    encoder         : Lavf54.59.106
    Stream #0:0(und): Video: mjpeg, yuvj420p, 320x180 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 90k tbn, 24 tbc
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : VideoHandler
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> mjpeg)
Press [q] to stop, [?] for help
[image2 @ 00000000023f7360] Could not get frame filename number 2 from pattern 'C:\xampp\htdocs\web\output\big_buck_bunny_frame_. 12d.24_40._t.._u.26880_bjho0_1432679541.u_.jpg' (either set updatefirst or use a pattern like %03d within the filename pattern)
av_interleaved_write_frame(): Invalid argument
<f-356530-5564f4750399f-9517f861642149b17d59f073b4672978> <c-356530-5564f4750399f-9517f861642149b17d59f073b4672978> <e-356530-5564f4750399f-9517f861642149b17d59f073b4672978>

Extraxt multiple segments - split

Hello!

I'm trying to extract multiple segments of a video without success. I want to mark a series of points (in an out) in a video to split this in<->out pieces of video. Reading the docs I've seen:
https://github.com/buggedcom/phpvideotoolkit-v2#splitting-a-audio-or-video-file-into-multiple-parts

It must be an array of either, all Timecode instances detailing the timecodes at which you wish to split the media, or all integers.

So I was trying to create an array with all timecodes, each one instantiated with the exactly seconds time, for example

...
$times[$i] = new Timecode($times[$i], Timecode::INPUT_FORMAT_SECONDS);
...

$video->split($times)->save('./output/big_buck_bunny_%timecode.mp4');

And when I was trying to run the code it throws:

The command "-f" has already been given and it cannot be repeated. If you wish to allow a repeating command, set $allow_command_repetition to true. 

Am I doing it right? Is this the way to extract multiple segments of a video given the pairs of in and out timecodes ?

Thanks!

Space in bin path (Windows)

If you pass a path to the binaries (e.g.: ffmpeg.exe) with a space in it to the Config class (e.g.: "ffmpeg" => "C:/ffmpeg files/ffmpeg.exe") a fatal error will be dispatched.

Adding quotes around the path in the ProcessBuilder.php:131 solves the issue.

Using this:

return '"' . $this->_program_path.'" '.$this->_combineArgumentList($this->_arguments);

Instead of this:

return $this->_program_path.' '.$this->_combineArgumentList($this->_arguments);

What did I miss installing the FFMPEG and the PHP-FFMPEG toolkit...

Can you someone show me the steps on how to install the FFMPEG toolkit for PHP, I have done the download and then the unzip and I used the composer,

I am trying to capture a frame for a video file and I do not see anything on the screen, all blank screen. if I use print command before the FFMPEG class it shows the output, if I place it after the class, I get nothing.....so what is wrong??!?!?!?

please use XXX ambiguous warning

It seems that there are a few messages about -qscale/-profile/-b etc being ambiguous and use separate audio/video versions?
Should the library be updated to correct these issues?

Run example script, I got error...

Hello,
When I run any script, I got error... like below
Warning: Unexpected character in input: '' (ASCII=92) state=1 in C:\AppServ\www\phpvideotoolkit-v2-master\examples\convert-to-flv.php on line 7

Warning: Unexpected character in input: '' (ASCII=92) state=1 in C:\AppServ\www\phpvideotoolkit-v2-master\examples\convert-to-flv.php on line 7

Parse error: syntax error, unexpected T_STRING in C:\AppServ\www\phpvideotoolkit-v2-master\examples\convert-to-flv.php on line 7

My system Apache V2.2.8, PHP V5.2.6
Any idea?

How to merge audio with video

Dear developers

This project is completely awesome.

But I can't find any doc for merge audio with mute video.

Can you please help me, How can i do this?

Thank you very much for developing this awesome project.

Running a clean command without any auto-added parameters

Hi,

Love the library, but I have a problem. There are several default flags built into a command which I would like to exclude from my command, as I want to build the command manually. Some of these command parameters are even outdated in newer versions of ffmpeg.

For instance, I want to use the crf flag to control quality, but 'qscale' is added to the command no matter what. Other items of interest are threads, vcodec, acodec, and the '-f' flag. All of these are out of date.

If one does not exist, can you please at least add a function that gives a clean command without any of that default stuff? If one exists, please let me know.

In the event that one does not exist, I am considering forking the project to create it and then will create a pull request, but if you know how to do this and I am just missing the correct function... I would love to know if it's possible!

Thanks
Michael

Cannot convert to animated gif

Hello,

I followed the example but unable to produce an animated gif. I tryied php, gifsicle and convert.

It keeps throwing:

[image2 @ 0000000003005520] Could not get frame filename number 2 from pattern 'path\temp\phpvideotoolkit_anigif_9k8fz_xfD197.tmp. 12d._i.._u.12364_63x7d_1430558687.u_.png' (either set updatefirst or use a pattern like %03d within the filename pattern)
av_interleaved_write_frame(): Invalid argument
frame=    2 fps=0.0 q=0.0 Lsize=N/A time=00:00:00.08 bitrate=N/A dup=1 drop=0   

If I try: setVideoMaxFrames(1) it can produce a gif file but not animated.

Do you have any idea about this?

Running proxy genaration in background

Hello!

I'm trying to generate video proxies of the uploaded videos in background for preview in my system and readi0ng the docs I reached this:

$this->video = new Video($path, $this->config);

$progress_handler = new ProgressHandlerOutput();

$output_format = new VideoFormat_Mp4(Format::OUTPUT, $this->config);
$output_format->setVideoRotation(true)
    ->setVideoFrameRate(18)
    ->setVideoQuality(70)
    ->setVideoPixelFormat('rgb24')
    ->setVideoDimensions(320, 240)
    ->setAudioSampleFrequency(44100);

$process = $this->video->saveNonBlocking('output.mp4', $output_format, Video::OVERWRITE_EXISTING, $progress_handler);

But when I access the page that call this code the conversion runs in foreground, the page just render after video is generated.

What I doing wrong?

Thanks.

Generate command without create file

Hello!

Is there a way to get the ffmpeg command that will be executed without run any save method?

My idea is to store in a database these commands to a service consume them.

Thanks.

Using cropdetect in ffmpeg

What would be fairly cool is a way to use cropdetect with ffmpeg. It would be nice that somehow this could be implemented as part of a workflow.

http://www.renevolution.com/understanding-ffmpeg-part-iii-cropping/
Below is an example of the console output when you add -vf cropdetect.
You run ffmpeg once outputting to a dummy file, only run a few seconds, then you have to run ffmpeg again with one of the supplied crop params ie crop=720:352:0:66 and bingo you get blackbars taken out.

[Parsed_cropdetect_1 @ 0x21bc100] x1:0 x2:719 y1:60 y2:422 w:720 h:352 x:0 y:66 pts:336 t:5.605656 crop=720:352:0:66
[Parsed_cropdetect_1 @ 0x21bc100] x1:0 x2:719 y1:60 y2:422 w:720 h:352 x:0 y:66 pts:338 t:5.639023 crop=720:352:0:66
[Parsed_cropdetect_1 @ 0x21bc100] x1:0 x2:719 y1:60 y2:422 w:720 h:352 x:0 y:66 pts:340 t:5.672390 crop=720:352:0:66
[Parsed_cropdetect_1 @ 0x21bc100] x1:0 x2:719 y1:60 y2:422 w:720 h:352 x:0 y:66 pts:342 t:5.705757 crop=720:352:0:66
[Parsed_cropdetect_1 @ 0x21bc100] x1:0 x2:719 y1:60 y2:422 w:720 h:352 x:0 y:66 pts:344 t:5.739124 crop=720:352:0:66
[Parsed_cropdetect_1 @ 0x21bc100] x1:0 x2:719 y1:60 y2:422 w:720 h:352 x:0 y:66 pts:346 t:5.772491 crop=720:352:0:66
[Parsed_cropdetect_1 @ 0x21bc100] x1:0 x2:719 y1:60 y2:422 w:720 h:352 x:0 y:66 pts:348 t:5.805858 crop=720:352:0:66

Config throws ConfigSetException

Configuring the toolkit like this

$config = new \PHPVideoToolkit\Config(array(
'temp_directory' => '...',
'ffmpeg' => '...',
'ffprobe' => '...',
));

leads to a ConfigSetException.

Adding a declaration like protected $_force_enable_flv_meta; to Config.php eliminates the ConfigSetException.

Sybio/gif-creator not found

When I tried to get the package through composer I get this error:

Problem 1

  • Installation request for buggedcom/phpvideotoolkit dev-master -> satisfiable by buggedcom/phpvideotoolkit[dev-master].
  • buggedcom/phpvideotoolkit dev-master requires sybio/gif-creator dev-master -> no matching package found.

Trying to make it works

hi,

I've installed all the components on my Centos 5 box and still have always the same issue with The ExecBuffer object has not yet been generated. Please call getExecBuffer() before calling isCompleted

here is my output debug

Array
(
[0] => ERROR---------
[1] => exception
[2] => Array
(
[0] => PHPVideoToolkit\FfmpegProcessException Object
(
[process:protected] => PHPVideoToolkit\FfmpegProcessProgressable Object
(
[_progress_callbacks:PHPVideoToolkit\FfmpegProcessProgressable:private] => Array
(
)

                        [_exec:protected] => 
                        [_pre_input_commands:protected] => Array
                            (
                            )

                        [_post_input_commands:protected] => Array
                            (
                            )

                        [_post_output_commands:protected] => Array
                            (
                            )

                        [_input:protected] => Array
                            (
                            )

                        [_output:protected] => 
                        [_non_blocking:protected] => 
                        [_progress_handler:protected] => 
                        [_detect_error:protected] => 
                        [_combined:protected] => 
                        [_program_path:protected] => /usr/bin/ffmpeg
                        [_arguments:protected] => Array
                            (
                            )

                        [_config] => PHPVideoToolkit\Config Object
                            (
                                [_ffmpeg:protected] => /usr/bin/ffmpeg
                                [_ffprobe:protected] => /usr/bin/ffprobe
                                [_yamdi:protected] => /usr/bin/yamdi
                                [_temp_directory:protected] => /var/www/vhosts/zenoob.com/polykrom/diables/tmp
                                [_qtfaststart:protected] => /usr/bin/qt-faststart
                                [_gif_transcoder:protected] => php
                                [_gifsicle:protected] => /usr/bin/gifsicle
                                [_convert:protected] => /usr/bin/convert
                            )

                    )

                [exec:protected] => 
                [message:protected] => The ExecBuffer object has not yet been generated. Please call getExecBuffer() before calling isCompleted.
                [string:Exception:private] => 
                [code:protected] => 0
                [file:protected] => /var/www/vhosts/zenoob.com/polykrom/diables/lib/FfmpegProcess.php
                [line:protected] => 384
                [trace:Exception:private] => Array
                    (
                        [0] => Array
                            (
                                [file] => /var/www/vhosts/zenoob.com/polykrom/diables/lib/FfmpegProcess.php
                                [line] => 546
                                [function] => _callExecBufferFunction
                                [class] => PHPVideoToolkit\FfmpegProcess
                                [type] => ->
                                [args] => Array
                                    (
                                        [0] => isCompleted
                                    )

                            )

                        [1] => Array
                            (
                                [file] => /var/www/vhosts/zenoob.com/polykrom/diables/examples/extract-frames.php
                                [line] => 15
                                [function] => isCompleted
                                [class] => PHPVideoToolkit\FfmpegProcess
                                [type] => ->
                                [args] => Array
                                    (
                                    )

                            )

                    )

                [previous:Exception:private] => 
            )

    )

)

Any help would be greatly appreciated ;)

Remote Progress Handling "The process output file cannot be found"

Hello!

I'm trying to add a JS in my page to load percentage of proxy generation but fallowing the docs:

$handler = new ProgressHandlerPortable($_SESSION['phpvideotoolkit_portable_process_id']);

$probe = $handler->probe();

echo json_encode(array(
    'finished' => $probe['finished'], // true when the process has ended by interruption, error or success
    'completed' => $probe['completed'], // true when the process has ended with a successful encoding that encountered no errors.
    'percentage' => $probe['percentage']
));

The page returns:

The process output file cannot be found. Please make sure that another process has not garbage collected the file. 
Stack Trace:
buggedcom/phpvideotoolkit/src/PHPVideoToolkit/ProgressHandlerPortable.php at line 62

The error is triggered when calls is_file($this->_output) because it gets some default temp_directory and I think that is_file just works when you pass the full path, not /tmp as is passing by default. When I set a Config with ProgressHandlerPortable works:

$config = new Config(array(
    'temp_directory' => $this->container->getParameter('kernel.root_dir').'/../web/tmp',
    'ffmpeg' => '/usr/bin/ffmpeg',
    'ffprobe' => '/home/cassiano/bin/ffprobe',
    'yamdi' => '/usr/bin/yamdi',
    'qtfaststart' => '/usr/local/bin/qt-faststart',
    'force_enable_qtfaststart' => true
));

$handler = new \PHPVideoToolkit\ProgressHandlerPortable($_SESSION['phpvideotoolkit_portable_process_id'], $config);

%timecode in extractSegment()

Hello!

I'm here trying to understand why the output file is badly formated when I try to use %timecode in output file. The test code:

try {
                $path = "/var/www/html/MyProject/app/../web/medias/original/2014_11/BigBuckBunny_320x180.mp4";
                var_dump($path);
                $config = new \PHPVideoToolkit\Config(array(
                    'temp_directory' => './tmp',
                    'ffmpeg' => '/usr/bin/ffmpeg',
                    'ffprobe' => '/home/cassiano/bin/ffprobe',
                    'yamdi' => '/usr/bin/yamdi',
                    'qtfaststart' => '/usr/local/bin/qt-faststart',
                ));
                $video = new Video($path, $config);
                $output_format = new VideoFormat_Mp4(Format::OUTPUT, $config);
                $process = $video->extractSegment(new Timecode(0, Timecode::INPUT_FORMAT_SECONDS), new Timecode(209.453, Timecode::INPUT_FORMAT_SECONDS))
                                ->save('./output/big_buck_bunny_%timecode.mp4', $output_format, Video::OVERWRITE_EXISTING);


                echo '<h1>Executed Command</h1>';
                \PHPVideoToolkit\Trace::vars($process->getExecutedCommand());
                echo '<hr /><h1>FFmpeg Process Messages</h1>';
                \PHPVideoToolkit\Trace::vars($process->getMessages());
                echo '<hr /><h1>Buffer Output</h1>';
                \PHPVideoToolkit\Trace::vars($process->getBuffer(true));
                echo '<hr /><h1>Resulting Output</h1>';
                $videos = $process->getOutput();
                $video_paths = array();
                if(empty($video) === false)
                {
                    foreach ($videos as $video)
                    {
                        array_push($video_paths, $video->getMediaPath());
                    }
                }
                \PHPVideoToolkit\Trace::vars($video_paths);
            }
            catch(\PHPVideoToolkit\FfmpegProcessOutputException $e)
            {
                echo '<h1>Error</h1>';
                \PHPVideoToolkit\Trace::vars($e);

                $process = $video->getProcess();
                if($process->isCompleted())
                {
                    echo '<hr /><h2>Executed Command</h2>';
                    \PHPVideoToolkit\Trace::vars($process->getExecutedCommand());
                    echo '<hr /><h2>FFmpeg Process Messages</h2>';
                    \PHPVideoToolkit\Trace::vars($process->getMessages());
                    echo '<hr /><h2>Buffer Output</h2>';
                    \PHPVideoToolkit\Trace::vars($process->getBuffer(true));
                }
            }
            catch(\PHPVideoToolkit\Exception $e)
            {
                echo '<h1>Error</h1>';
                \PHPVideoToolkit\Trace::vars($e->getMessage());
                echo '<h2>\PHPVideoToolkit\Exception</h2>';
                \PHPVideoToolkit\Trace::vars($e);
            }

The outputs:

Executed Command:

/usr/bin/ffmpeg '-i' '/var/www/html/MyProject/web/medias/original/2014_11/BigBuckBunny_320x180.mp4' '-y' '-ss' '00:00:00.000' '-t' '209.453' '-q' '4' '-f' 'mp4' '-strict' 'experimental' '-threads' '1' '-acodec' 'aac' '-ar' '22050' '-vcodec' 'h264' '/var/www/html/MyProject/web/output/big_buck_bunny_.%12d.24_0._t.._u.32774_wb8v0_1418672503.u_.mp4'

FFmpeg Process Messages:

Array
(
    [libx264] => Array
        (
            [0x21f1f80] => Array
                (
                    [0] => -qscale is ignored, -crf is recommended.
                    [1] => using SAR=1/1
                    [2] => using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX AVX2 FMA3 LZCNT BMI2
                    [3] => profile High, level 1.2
                    [4] => 264 - core 142 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=1 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=24 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
                    [5] => frame I:48    Avg QP:18.65  size: 12800
                    [6] => frame P:2759  Avg QP:23.07  size:  1186
                    [7] => frame B:2220  Avg QP:28.41  size:   224
                    [8] => consecutive B-frames: 33.4% 19.1% 12.1% 35.4%
                    [9] => mb I  I16..4: 31.4% 14.8% 53.7%
                    [10] => mb P  I16..4:  1.1%  1.7%  1.1%  P16..4: 31.4%  9.2%  7.2%  0.0%  0.0%    skip:48.3%
                    [11] => mb B  I16..4:  0.1%  0.2%  0.3%  B16..8: 21.5%  2.2%  0.8%  direct: 0.8%  skip:74.2%  L0:38.5% L1:51.9% BI: 9.6%
                    [12] => 8x8 transform intra:35.3% inter:50.9%
                    [13] => coded y,uvDC,uvAC intra: 60.4% 81.1% 51.4% inter: 12.8% 14.3% 3.2%
                    [14] => i16 v,h,dc,p: 23% 32% 22% 23%
                    [15] => i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 21% 18% 26%  4%  6%  6%  6%  6%  7%
                    [16] => i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 33% 15% 15%  5%  7%  6%  7%  6%  6%
                    [17] => i8c dc,h,v,p: 48% 24% 17% 10%
                    [18] => Weighted P-Frames: Y:2.0% UV:0.7%
                    [19] => ref P L0: 71.4% 15.2%  9.2%  4.2%  0.0%
                    [20] => ref B L0: 88.0%  9.9%  2.1%
                    [21] => ref B L1: 94.2%  5.8%
                    [22] => kb/s:167.47
                )

        )

)

Buffer Output

ffmpeg version 2.4.git Copyright (c) 2000-2014 the FFmpeg developers
  built on Nov  4 2014 18:00:10 with gcc 4.9.1 (Ubuntu 4.9.1-16ubuntu6)
  configuration: --prefix=/home/cassiano/ffmpeg_build --extra-cflags=-I/home/cassiano/ffmpeg_build/include --extra-ldflags=-L/home/cassiano/ffmpeg_build/lib --bindir=/home/cassiano/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-x11grab
  libavutil      54. 11.100 / 54. 11.100
  libavcodec     56. 10.102 / 56. 10.102
  libavformat    56. 12.100 / 56. 12.100
  libavdevice    56.  2.100 / 56.  2.100
  libavfilter     5.  2.102 /  5.  2.102
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/var/www/html/Archive/web/medias/original/2014_11/BigBuckBunny_320x180.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: mp41
    creation_time   : 1970-01-01 00:00:00
    title           : Big Buck Bunny
    artist          : Blender Foundation
    composer        : Blender Foundation
    date            : 2008
    encoder         : Lavf52.14.0
  Duration: 00:09:56.46, start: 0.000000, bitrate: 867 kb/s
    Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 320x180 [SAR 1:1 DAR 16:9], 702 kb/s, 24 fps, 24 tbr, 24 tbn, 48 tbc (default)
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 159 kb/s (default)
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : SoundHandler
[libx264 @ 0x21f1f80] -qscale is ignored, -crf is recommended.
[libx264 @ 0x21f1f80] using SAR=1/1
[libx264 @ 0x21f1f80] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX AVX2 FMA3 LZCNT BMI2
[libx264 @ 0x21f1f80] profile High, level 1.2
[libx264 @ 0x21f1f80] 264 - core 142 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=1 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=24 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to '/var/www/html/Archive/web/output/big_buck_bunny_.%12d.24_0._t.._u.32774_wb8v0_1418672503.u_.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: mp41
    date            : 2008
    title           : Big Buck Bunny
    artist          : Blender Foundation
    composer        : Blender Foundation
    encoder         : Lavf56.12.100
    Stream #0:0(und): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 320x180 [SAR 1:1 DAR 16:9], q=-1--1, 24 fps, 12288 tbn, 24 tbc (default)
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : VideoHandler
      encoder         : Lavc56.10.102 libx264
    Stream #0:1(und): Audio: aac ([64][0][0][0] / 0x0040), 22050 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : SoundHandler
      encoder         : Lavc56.10.102 aac
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
frame=  161 fps=0.0 q=28.0 size=     212kB time=00:00:06.94 bitrate= 250.7kbits/s    
frame=  296 fps=296 q=28.0 size=     509kB time=00:00:12.51 bitrate= 333.0kbits/s    
frame=  453 fps=301 q=28.0 size=     896kB time=00:00:19.06 bitrate= 385.1kbits/s    
frame=  609 fps=303 q=28.0 size=    1174kB time=00:00:25.60 bitrate= 375.6kbits/s    
frame=  711 fps=283 q=28.0 size=    1435kB time=00:00:29.83 bitrate= 394.0kbits/s    
frame=  826 fps=274 q=28.0 size=    1727kB time=00:00:34.61 bitrate= 408.6kbits/s    
frame=  931 fps=265 q=28.0 size=    1970kB time=00:00:39.03 bitrate= 413.6kbits/s    
frame= 1050 fps=261 q=28.0 size=    2207kB time=00:00:43.95 bitrate= 411.3kbits/s    
frame= 1193 fps=264 q=28.0 size=    2509kB time=00:00:49.89 bitrate= 412.0kbits/s    
frame= 1309 fps=261 q=28.0 size=    2769kB time=00:00:54.77 bitrate= 414.1kbits/s    
frame= 1450 fps=262 q=28.0 size=    3036kB time=00:01:00.62 bitrate= 410.2kbits/s    
frame= 1634 fps=271 q=28.0 size=    3362kB time=00:01:08.28 bitrate= 403.3kbits/s    
frame= 1762 fps=270 q=28.0 size=    3625kB time=00:01:13.62 bitrate= 403.3kbits/s    
frame= 1879 fps=267 q=28.0 size=    3867kB time=00:01:18.50 bitrate= 403.5kbits/s    
frame= 1982 fps=263 q=28.0 size=    4162kB time=00:01:22.77 bitrate= 411.9kbits/s    
frame= 2127 fps=265 q=28.0 size=    4405kB time=00:01:28.81 bitrate= 406.3kbits/s    
frame= 2314 fps=271 q=28.0 size=    4666kB time=00:01:36.61 bitrate= 395.6kbits/s    
frame= 2531 fps=280 q=28.0 size=    5030kB time=00:01:45.67 bitrate= 389.9kbits/s    
frame= 2672 fps=280 q=28.0 size=    5296kB time=00:01:51.52 bitrate= 389.0kbits/s    
frame= 2804 fps=279 q=28.0 size=    5557kB time=00:01:57.04 bitrate= 389.0kbits/s    
frame= 2946 fps=280 q=28.0 size=    5876kB time=00:02:02.94 bitrate= 391.5kbits/s    
frame= 3087 fps=280 q=25.0 size=    6154kB time=00:02:08.79 bitrate= 391.4kbits/s    
frame= 3234 fps=280 q=28.0 size=    6417kB time=00:02:14.97 bitrate= 389.4kbits/s    
frame= 3408 fps=283 q=28.0 size=    6759kB time=00:02:22.22 bitrate= 389.3kbits/s    
frame= 3550 fps=283 q=28.0 size=    7022kB time=00:02:28.11 bitrate= 388.4kbits/s    
frame= 3716 fps=285 q=28.0 size=    7349kB time=00:02:35.03 bitrate= 388.3kbits/s    
frame= 3929 fps=290 q=28.0 size=    7721kB time=00:02:43.90 bitrate= 385.9kbits/s    
frame= 4086 fps=291 q=28.0 size=    8024kB time=00:02:50.45 bitrate= 385.6kbits/s    
frame= 4248 fps=292 q=28.0 size=    8285kB time=00:02:57.18 bitrate= 383.1kbits/s    
frame= 4409 fps=293 q=28.0 size=    8659kB time=00:03:03.92 bitrate= 385.7kbits/s    
frame= 4533 fps=291 q=28.0 size=    8953kB time=00:03:09.07 bitrate= 387.9kbits/s    
frame= 4686 fps=291 q=28.0 size=    9267kB time=00:03:15.48 bitrate= 388.3kbits/s    
frame= 4842 fps=292 q=28.0 size=    9590kB time=00:03:21.94 bitrate= 389.0kbits/s    
frame= 4998 fps=293 q=28.0 size=    9872kB time=00:03:28.44 bitrate= 388.0kbits/s    
frame= 5027 fps=291 q=28.0 Lsize=   10141kB time=00:03:29.46 bitrate= 396.6kbits/s    
video:4283kB audio:5743kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.148757%
[libx264 @ 0x21f1f80] frame I:48    Avg QP:18.65  size: 12800
[libx264 @ 0x21f1f80] frame P:2759  Avg QP:23.07  size:  1186
[libx264 @ 0x21f1f80] frame B:2220  Avg QP:28.41  size:   224
[libx264 @ 0x21f1f80] consecutive B-frames: 33.4% 19.1% 12.1% 35.4%
[libx264 @ 0x21f1f80] mb I  I16..4: 31.4% 14.8% 53.7%
[libx264 @ 0x21f1f80] mb P  I16..4:  1.1%  1.7%  1.1%  P16..4: 31.4%  9.2%  7.2%  0.0%  0.0%    skip:48.3%
[libx264 @ 0x21f1f80] mb B  I16..4:  0.1%  0.2%  0.3%  B16..8: 21.5%  2.2%  0.8%  direct: 0.8%  skip:74.2%  L0:38.5% L1:51.9% BI: 9.6%
[libx264 @ 0x21f1f80] 8x8 transform intra:35.3% inter:50.9%
[libx264 @ 0x21f1f80] coded y,uvDC,uvAC intra: 60.4% 81.1% 51.4% inter: 12.8% 14.3% 3.2%
[libx264 @ 0x21f1f80] i16 v,h,dc,p: 23% 32% 22% 23%
[libx264 @ 0x21f1f80] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 21% 18% 26%  4%  6%  6%  6%  6%  7%
[libx264 @ 0x21f1f80] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 33% 15% 15%  5%  7%  6%  7%  6%  6%
[libx264 @ 0x21f1f80] i8c dc,h,v,p: 48% 24% 17% 10%
[libx264 @ 0x21f1f80] Weighted P-Frames: Y:2.0% UV:0.7%
[libx264 @ 0x21f1f80] ref P L0: 71.4% 15.2%  9.2%  4.2%  0.0%
[libx264 @ 0x21f1f80] ref B L0: 88.0%  9.9%  2.1%
[libx264 @ 0x21f1f80] ref B L1: 94.2%  5.8%
[libx264 @ 0x21f1f80] kb/s:167.47
<c-644661-548f39773cc17-e550801214abf9e221ea507a4dbb5a79>

Resulting Output

Array
(
    [0] => /var/www/html/MyProject/web/output/big_buck_bunny_.%12d.24_0._t..mp4
)

Aspect ratio for extracted frame

Help me guys with this: I test video 640x480.

Its normal video, without rotation. Extracted frame looks like:
0324864_05

Then I rotate video and then extract same frame:
0324866_05

There aspect ratio trouble. When I manually set aspect ratio - it looks good.
First minds is extracting video dimensions and put aspect ration to "extract frame" code. Is it good idea or exists another workaround?

%timecode output extractFrames()

I would like to understand the format of the string generated when using %timecode for filename in extractFrames method. For example: big_buck_bunny_frame_.000000000001.30_0._t..u.91583_w6xim_1401908794.u.jpg

I'd like to construct a timeline with thumbs of the video but I need the timecode from each image to link to in the video.

Thanks!

Phpvideotoolkit - "maxlen '=>' 3072 ' in buggedcom \ phpvideotoolkit \ src \ PHPVideoToolkit \ Mime.php line 202"

Hello,
I'm trying to integrate PHPVideoToolKit in Symfony2, to generate prviews some videos.

Running directly from PHP I have no problem and works properly, but when in full in Symfony2, I stuck when he tells me that you can not convert a file larger than 3072.

"maxlen '=>' 3072 ')) in C: \ xampp \ htdocs \ www \ VideoLab \ vendor \ buggedcom \ phpvideotoolkit \ src \ PHPVideoToolkit \ Mime.php line 202"

I added the Symfony library by:
"require": {
"ffmpeg-php / php-ffmpeg" "dev-master"
"pulse00 / ffmpeg-bundle": "dev-master"
"buggedcom / phpvideotoolkit" "dev-master"

and I installed all the libraries correctly in the Vendors.

Not if you've encountered the problem and have a possible solution.

image

image

Than You very much
Xavier Collado

Wrong Timecode parse

360 seconds was parsed into 00:05:60.00

Error:

Encoding failed and an error was returned from ffmpeg. Error code 1 was returned the message (if any) was: Invalid duration specification for ss: 00:05:60.00

Create composer version

Hi

Could you create a git tag with a version number please so that I can use your library with composer?

Thanks ;)

Watermark

I found in this changelog that there is a addWatermark method, but I can't find it in the source code of current master.

Does this version support watermarking?

Thank you in advance
Pedro

Example Code - convert to flv throws Exception

After downloading the latest version of the library, I can now get all example codes to work on Windows 7 except for the convert-to-flv.php example file. Big thanks to Oliver Lillie for your constantly and responsive supports.

Even though it generated correct .flv file, the convert-to-flv.php throws \PHPVideoToolkit\Exception on line 41.

In the post-generated step, it complains that it could not find the $output even though the output was generated.
Please help me resolve this issue, and thank you in advance.

My development environment:
Windows 7
PHP 5.4
XAMPP

[0] => 8
[1] => Undefined variable: output
[2] => C:\xampp\htdocs\www\webedu.local\video\lib\FfmpegProcessProgressable.php
[3] => 292

// Line 136-148 of Flv.php

if($exec->hasError() === true)
{
    if(is_file($temp_output) === true)
    {
        @unlink($temp_output);
    }
if($this->_enforce_meta_data_success === true)
{
    @unlink($output);
    throw new FfmpegProcessPostProcessException('Yamdi post processing of "'.$output.'" failed. The output file has been removed. Any additional Yamdi message follows:
'.$exec->getBuffer());
}
// TODO, log or exception not sure as the original file is ok.
}

Yamdi post processing of "" failed. The output file has been removed. Any additional Yamdi message follows:

Windows Support

Hey,

I like what you have going here. But does not seem to support Windows? Is that correct?

Thank you.

On Windows: ExecBuffer->getLastLine() failes to detect valid last line

Exec command:
((C:\SysTemp\Programs\ffmpeg\bin\ffmpeg.exe "-i" "C:\project\webroot\video_files\255\tmpfile" && echo "&lt;c-792770-51f637e42fa54-0a046cbf46f41e86ab336e6e7116072c&gt;") || echo "&lt;f-768572-51f63487c86d2-0a046cbf46f41e86ab336e6e7116072c&gt;" "&lt;c-768572-51f63487c86d2-0a046cbf46f41e86ab336e6e7116072c&gt;" "&lt;e-768572-51f63487c86d2-0a046cbf46f41e86ab336e6e7116072c&gt;"$?) 2>&1 > "C:\OpenServer\userdata\temp\php43A9.tmp" 2>&1 &
Tmp file:

ffmpeg version N-54772-g53c853e Copyright (c) 2000-2013 the FFmpeg developers
  built on Jul 16 2013 22:25:42 with gcc 4.7.3 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52. 40.100 / 52. 40.100
  libavcodec     55. 18.102 / 55. 18.102
  libavformat    55. 12.102 / 55. 12.102
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 81.101 /  3. 81.101
  libswscale      2.  3.100 /  2.  3.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
Input #0, mpeg, from 'C:\web_site\castarauto\webroot\video_files\255\tmpfile':
  Duration: 00:00:19.92, start: 0.540000, bitrate: 515 kb/s
    Stream #0:0[0x1e0]: Video: mpeg1video, yuv420p, 640x480 [SAR 1:1 DAR 4:3], 104857 kb/s, 25 fps, 25 tbr, 90k tbn, 25 tbc
At least one output file must be specified
"&lt;f-768572-51f63487c86d2-0a046cbf46f41e86ab336e6e7116072c&gt;" "&lt;c-768572-51f63487c86d2-0a046cbf46f41e86ab336e6e7116072c&gt;" "&lt;e-768572-51f63487c86d2-0a046cbf46f41e86ab336e6e7116072c&gt;"$?

ExecBuffer->getLastLine() gets
"&lt;f-768572-51f63487c86d2-0a046cbf46f41e86ab336e6e7116072c&gt;" "&lt;c-768572-51f63487c86d2-0a046cbf46f41e86ab336e6e7116072c&gt;" "&lt;e-768572-51f63487c86d2-0a046cbf46f41e86ab336e6e7116072c&gt;"$? instead of "At least one output file must be specified"

This throws exception because $lastLine != "At least one output file must be specified" in MediaParser line 648

2.2 beta

getting back to your code after you merged the multi-file update. getting am error when loading a video. Undefined class constant 'Input' in /.../.../vendor/buggedcom/phpvideotoolkit/src/PHPVideoToolkit/Media.php on line 199.

Extract frames and resize it

Hello!

I would like to extract and resize frames with ffmpeg. I didn't find anything in the docs or examples folder. But I saw that exists a method to resize in phpvideotoolkit-v2 / emulators / ffmpeg-php / ffmpeg_frame.php

Like you've added in #25 now it is possible to extract frames in different ranges but I would like also to resize these frames, with this command is possible, for example:

ffmpeg -i ~/BigBuckBunny_320x180.mp4 -s 50x10 -f image2 -vf fps=fps=1/60 img%03d.jpg

where the "-s 50x50" is the resize option given width x height. I've tested adding this parameter at the end of command this without success, works just after "-i <video_path>"

Thanks!

extractFrames() problem

Hi, the extractFrames function for extract multiple thumbnails of a video don't work for me..
The single extractFrame() work well, but the multiple extraction produces only 1 image.

And if i use

$frames = $process->getOutput();
        $frame_paths = array();
        if(empty($frames) === false)
        {
            foreach ($frames as $frame)
            {
                array_push($frame_paths, $frame->getMediaPath());
            }
        }
    }

for get array, like the docs suggest i have this error:

Fatal error: Uncaught exception 'PHPVideoToolkit\FfmpegProcessOutputException' with message 'Encoding failed and an error was returned from ffmpeg. Error code  was returned the message (if any) was: av_interleaved_write_frame(): Invalid argument' in FfmpegProcessProgressable.php on line 208

i use this for processing:

$filePath = 'input\videoplayback.mp4';
$outputPath = 'output\test_%timecode.jpg';

$output_format = new ImageFormat_Jpeg('output', $this->config());
$video  = new Video($filePath, $this->config());
$process = $video->extractFrames(new Timecode(40), new Timecode(50), 1)
  ->save($outputPath, $output_format);

..Other tasks like transcoding and seems work well without errors.

But.. i run this on windows.. and i read that does not work well on windows system..i had also these warning when inizialize:

Notice: Use of undefined constant PATH - assumed 'PATH' in Mime.php on line 83
Notice: Use of undefined constant DS - assumed 'DS' in Mime.php on line 83
Notice: Use of undefined constant DS - assumed 'DS' in Mime.php on line 83
Warning: Invalid argument supplied for foreach() in Mime.php on line 203

I use 2.1.5 version with raccomanded ffmpeg version.

Question: mutiple outputs

Not seeing a way to submit multiple outputs, I attempted using the addPostOutputCommand to append another output such as an mp3. wondering if there is a plan implement this or tee - similar.

FFmpeg appears to be unavailable on your system

I'm trying to use the examples, specifically the combine-images-to-video.php which you kindly committed yesterday. Unfortunately even though I set the correct ffmpeg path in the config /usr/local/bin/ffmpeg I get an exception that FFmpeg appears to be unavailable on your system.

When I run /usr/local/bin/ffmpeg from terminal on my Mac it appears fine

ffmpeg version 2.5.3 Copyright (c) 2000-2015 the FFmpeg developers
  built on Feb  8 2015 10:02:12 with Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/2.5.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid --enable-librtmp --enable-libfaac --enable-libfdk-aac --enable-libopenjpeg --disable-decoder=jpeg2000 --extra-cflags='-I/usr/local/Cellar/openjpeg/1.5.1_1/include/openjpeg-1.5 ' --enable-nonfree --enable-vda
  libavutil      54. 15.100 / 54. 15.100
  libavcodec     56. 13.100 / 56. 13.100
  libavformat    56. 15.102 / 56. 15.102
  libavdevice    56.  3.100 / 56.  3.100
  libavfilter     5.  2.103 /  5.  2.103
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

Bear in mind I am using ffmpeg version 2.5.3 but I assume it would find the binary regardless of the version?

setTempDirectory

Hi ,

When i try to use the ProgressHandlerNative i get an error.

Call to undefined method PHPVideoToolkit\ProgressHandlerNative::setTempDirectory() in /var/www/html/etc...

This is my code:

namespace PHPVideoToolkit;
include_once './includes/bootstrap.php';

$video  = new Video('media/BigBuckBunny_320x180.mp4', $config);

$progress_handler = new ProgressHandlerNative(function($data)
{
    echo '<pre>'.print_r($data, true).'</pre>';
});

$output = $video->purgeMetaData()
                ->setMetaData('title', 'Hello World')
                ->save('./output/big_buck_bunny.mp4', null, Video::OVERWRITE_EXISTING, $progress_handler);

I'm on linux if this helps.

Settings codecs

Hi,

I'm trying to convert a video file and i want to set the audio codec to aac as it defaults to mp3 for now.I've tried to use the addCommand but it just pass the command twice.If you can please provide more examples, i've used phpvideotoolkit v1 for more than a year and it's great.

Timeout in ProgressHandlerNative

Hello,

I am getting this issue in one of my user:

Maximum execution time of 120 seconds exceeded -ProgressHandlerNative:99. Which is:

for($i=1, $l=count($data_parts)-1; $i<$l; $i+=2)
{
    $data[$data_parts[$i]] = $data_parts[$i+1];
}

What could be the problem here? I do not see a reason for this loop take up to few seconds.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.