phpvideotoolkit-v2
phpvideotoolkit-v2 copied to clipboard
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>
It seems that the exec command that you are running is missing a % sign for some reason. If you run this command in the command line:
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"
Does it work ok?
possibly related to #51
Hello, first thank You for quick response. The command that You wrote is OK in the command line. It's giving 240 pictures, frame by frame.