ff_frame_thread_encoder_init failed when run via PHP exec

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

ff_frame_thread_encoder_init failed when run via PHP exec

rwilkin
Hi,

I am very new to ffmpeg, so sorry if this is a silly question.

I am trying to create a thumbnail image from a video with PHP. This is the
command I am using:

"/home2/public_html/ffmpeg/ffmpeg" -i
"/home2/public_html/ffmpeg/SampleVideo.mp4" -ss 00:00:01.000 -vframes 1 -y
"/home2/public_html/ffmpeg/SampleVideo.png" -loglevel debug 2>
"/home2/public_html/ffmpeg/wildlife.txt"

It works perfectly when I log in to the console via putty and run it. But
when I run it via exec() in PHP it always comes back with
ff_frame_thread_encoder_init failed Error initializing output stream 0:0 --
Error while opening encoder for output stream #0:0 - maybe incorrect
parameters such as bit_rate, rate, width or height.

Below are the logs from the console and the PHP page.
I am using version v4.0.1-64bit-static of ffmpeg.

Thank you very much for any help.

This is the log from the *console*:
ffmpeg version 4.0.1-static https://johnvansickle.com/ffmpeg/  Copyright (c)
2000-2018 the FFmpeg developers
  built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
  configuration: --enable-gpl --enable-version3 --enable-static
--disable-debug --disable-ffplay --disable-indev=sndio
--disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r
--enable-gnutls --enable-gray --enable-libaom --enable-libfribidi
--enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame
--enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg
--enable-librubberband --enable-libsoxr --enable-libspeex --enable-libvorbis
--enable-libopus --enable-libtheora --enable-libvidstab
--enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264
--enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg
  libavutil      56. 14.100 / 56. 14.100
  libavcodec     58. 18.100 / 58. 18.100
  libavformat    58. 12.100 / 58. 12.100
  libavdevice    58.  3.100 / 58.  3.100
  libavfilter     7. 16.100 /  7. 16.100
  libswscale      5.  1.100 /  5.  1.100
  libswresample   3.  1.100 /  3.  1.100
  libpostproc    55.  1.100 / 55.  1.100
Splitting the commandline.
Reading option '-i' ... matched as input url with argument
'/home2/public_html/ffmpeg/SampleVideo.mp4'.
Reading option '-ss' ... matched as option 'ss' (set the start time offset)
with argument '00:00:01.000'.
Reading option '-vframes' ... matched as option 'vframes' (set the number of
video frames to output) with argument '1'.
Reading option '-y' ... matched as option 'y' (overwrite output files) with
argument '1'.
Reading option '/home2/public_html/ffmpeg/SampleVideo.png' ... matched as
output url.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging
level) with argument 'debug'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option y (overwrite output files) with argument 1.
Applying option loglevel (set logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input url
/home2/public_html/ffmpeg/SampleVideo.mp4.
Successfully parsed a group of options.
Opening an input file: /home2/public_html/ffmpeg/SampleVideo.mp4.
[NULL @ 0x5b0fc00] Opening '/home2/public_html/ffmpeg/SampleVideo.mp4' for
reading
[file @ 0x5b10500] Setting default whitelist 'file,crypto'
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5b0fc00] Format mov,mp4,m4a,3gp,3g2,mj2 probed
with size=2048 and score=100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5b0fc00] ISO: File Type Major Brand: isom
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5b0fc00] Unknown dref type 0x206c7275 size 12
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5b0fc00] Processing st: 0, edit list 0 - media
time: 0, duration: 172544
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5b0fc00] Unknown dref type 0x206c7275 size 12
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5b0fc00] Processing st: 1, edit list 0 - media
time: 0, duration: 648192
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5b0fc00] Before avformat_find_stream_info()
pos: 2107842 bytes read:41625 seeks:1 nb_streams:2
[h264 @ 0x5b11580] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0x5b11580] nal_unit_type: 8, nal_ref_idc: 3
[h264 @ 0x5b11580] nal_unit_type: 5, nal_ref_idc: 3
[h264 @ 0x5b11580] Format yuv420p chosen by get_format().
[h264 @ 0x5b11580] Reinit context to 1280x720, pix_fmt: yuv420p
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5b0fc00] All info found
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5b0fc00] After avformat_find_stream_info() pos:
106237 bytes read:147814 seeks:2 frames:2
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from
'/home2/public_html/ffmpeg/SampleVideo.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    creation_time   : 1970-01-01T00:00:00.000000Z
    encoder         : Lavf53.24.2
  Duration: 00:00:13.50, start: 0.000000, bitrate: 1248 kb/s
    Stream #0:0(und), 1, 1/12800: Video: h264 (Main), 1 reference frame
(avc1 / 0x31637661), yuv420p(left), 1280x720 [SAR 1:1 DAR 16:9], 0/1, 862
kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
    Metadata:
      creation_time   : 1970-01-01T00:00:00.000000Z
      handler_name    : VideoHandler
    Stream #0:1(und), 1, 1/48000: Audio: aac (LC) (mp4a / 0x6134706D), 48000
Hz, 5.1, fltp, 381 kb/s (default)
    Metadata:
      creation_time   : 1970-01-01T00:00:00.000000Z
      handler_name    : SoundHandler
Successfully opened the file.
Parsing a group of options: output url
/home2/public_html/ffmpeg/SampleVideo.png.
Applying option ss (set the start time offset) with argument 00:00:01.000.
Applying option vframes (set the number of video frames to output) with
argument 1.
Successfully parsed a group of options.
Opening an output file: /home2/public_html/ffmpeg/SampleVideo.png.
Successfully opened the file.
detected 20 logical cores
[h264 @ 0x5b17ac0] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0x5b17ac0] nal_unit_type: 8, nal_ref_idc: 3
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> png (native))
Press [q] to stop, [?] for help
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
    Last message repeated 2 times
[h264 @ 0x5b17ac0] nal_unit_type: 5, nal_ref_idc: 3
[h264 @ 0x5b17ac0] Format yuv420p chosen by get_format().
[h264 @ 0x5b17ac0] Reinit context to 1280x720, pix_fmt: yuv420p
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
[h264 @ 0x5b32800] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
[h264 @ 0x5bb0840] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
[h264 @ 0x5bccc00] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
[h264 @ 0x5be92c0] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
[h264 @ 0x5c05700] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
[h264 @ 0x5c21b40] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
[h264 @ 0x5c3df80] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
[h264 @ 0x5c5a700] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
[h264 @ 0x5c76e40] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
[h264 @ 0x5c93580] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
[h264 @ 0x5cafc80] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
[h264 @ 0x5ccc3c0] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
[h264 @ 0x5ce8b00] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
[h264 @ 0x5d05240] nal_unit_type: 1, nal_ref_idc: 2
[h264 @ 0x5d218c0] nal_unit_type: 1, nal_ref_idc: 2
[graph 0 input from stream 0:0 @ 0x62b56c0] Setting 'video_size' to value
'1280x720'
[graph 0 input from stream 0:0 @ 0x62b56c0] Setting 'pix_fmt' to value '0'
[graph 0 input from stream 0:0 @ 0x62b56c0] Setting 'time_base' to value
'1/12800'
[graph 0 input from stream 0:0 @ 0x62b56c0] Setting 'pixel_aspect' to value
'1/1'
[graph 0 input from stream 0:0 @ 0x62b56c0] Setting 'sws_param' to value
'flags=2'
[graph 0 input from stream 0:0 @ 0x62b56c0] Setting 'frame_rate' to value
'25/1'
[graph 0 input from stream 0:0 @ 0x62b56c0] w:1280 h:720 pixfmt:yuv420p
tb:1/12800 fr:25/1 sar:1/1 sws_param:flags=2
[format @ 0x62b55c0] Setting 'pix_fmts' to value
'rgb24|rgba|rgb48be|rgba64be|pal8|gray|ya8|gray16be|ya16be|monob'
[auto_scaler_0 @ 0x62b6040] Setting 'flags' to value 'bicubic'
[auto_scaler_0 @ 0x62b6040] w:iw h:ih flags:'bicubic' interl:0
[format @ 0x62b55c0] auto-inserting filter 'auto_scaler_0' between the
filter 'Parsed_null_0' and the filter 'format'
[AVFilterGraph @ 0x5b5ef80] query_formats: 5 queried, 3 merged, 1 already
done, 0 delayed
[auto_scaler_0 @ 0x62b6040] picking rgb24 out of 9 ref:yuv420p alpha:0
[auto_scaler_0 @ 0x62b6040] w:1280 h:720 fmt:yuv420p sar:1/1 -> w:1280 h:720
fmt:rgb24 sar:1/1 flags:0x4
Output #0, image2, to '/home2/public_html/ffmpeg/SampleVideo.png':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.12.100
    Stream #0:0(und), 0, 1/25: Video: png, 1 reference frame, rgb24(left),
1280x720 [SAR 1:1 DAR 16:9], 0/1, q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc
(default)
    Metadata:
      creation_time   : 1970-01-01T00:00:00.000000Z
      handler_name    : VideoHandler
      encoder         : Lavc58.18.100 png
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
[h264 @ 0x5b17ac0] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
[h264 @ 0x5b32800] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
[h264 @ 0x5bb0840] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
[h264 @ 0x5bccc00] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
[h264 @ 0x5be92c0] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
    Last message repeated 1 times
[h264 @ 0x5c05700] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
[h264 @ 0x5c21b40] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
[h264 @ 0x5c3df80] nal_unit_type: 1, nal_ref_idc: 2
[h264 @ 0x5c5a700] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
[h264 @ 0x5c76e40] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
[h264 @ 0x5c93580] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
[h264 @ 0x5cafc80] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
[h264 @ 0x5ccc3c0] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
[h264 @ 0x5ce8b00] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
[h264 @ 0x5d05240] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
[h264 @ 0x5d218c0] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
[h264 @ 0x5b17ac0] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
[h264 @ 0x5b32800] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
[h264 @ 0x5bb0840] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
[h264 @ 0x5bccc00] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
[h264 @ 0x5be92c0] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
[h264 @ 0x5c05700] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
[h264 @ 0x5c21b40] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
[h264 @ 0x5c3df80] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
[h264 @ 0x5c5a700] nal_unit_type: 1, nal_ref_idc: 2
Clipping frame in rate conversion by 0.000008
No more output streams to write to, finishing.
[image2 @ 0x5b22e00] Opening '/home2/public_html/ffmpeg/SampleVideo.png' for
writing
[file @ 0x5df77c0] Setting default whitelist 'file,crypto'
[AVIOContext @ 0x5df78c0] Statistics: 0 seeks, 8 writeouts
frame=    1 fps=0.0 q=-0.0 Lsize=N/A time=00:00:00.04 bitrate=N/A
speed=0.117x    
video:1883kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: unknown
Input file #0 (/home2/public_html/ffmpeg/SampleVideo.mp4):
  Input stream #0:0 (video): 41 packets read (337478 bytes); 27 frames
decoded;
  Input stream #0:1 (audio): 1 packets read (967 bytes);
  Total: 42 packets (338445 bytes) demuxed
Output file #0 (/home2/public_html/ffmpeg/SampleVideo.png):
  Output stream #0:0 (video): 1 frames encoded; 1 packets muxed (1928166
bytes);
  Total: 1 packets (1928166 bytes) muxed
27 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0x5b18940] Statistics: 475494 bytes read, 2 seeks


and this is the log from the *PHP page*:
ffmpeg version 4.0.1-static https:/johnvansickle.com/ffmpeg/  Copyright (c)
2000-2018 the FFmpeg developers
  built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
  configuration: --enable-gpl --enable-version3 --enable-static
--disable-debug --disable-ffplay --disable-indev=sndio
--disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r
--enable-gnutls --enable-gray --enable-libaom --enable-libfribidi
--enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame
--enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg
--enable-librubberband --enable-libsoxr --enable-libspeex --enable-libvorbis
--enable-libopus --enable-libtheora --enable-libvidstab
--enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264
--enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg
  libavutil      56. 14.100 / 56. 14.100
  libavcodec     58. 18.100 / 58. 18.100
  libavformat    58. 12.100 / 58. 12.100
  libavdevice    58.  3.100 / 58.  3.100
  libavfilter     7. 16.100 /  7. 16.100
  libswscale      5.  1.100 /  5.  1.100
  libswresample   3.  1.100 /  3.  1.100
  libpostproc    55.  1.100 / 55.  1.100
Splitting the commandline.
Reading option '-i' ... matched as input url with argument
'/home2/public_html/ffmpeg/SampleVideo.mp4'.
Reading option '-ss' ... matched as option 'ss' (set the start time offset)
with argument '00:00:01.000'.
Reading option '-vframes' ... matched as option 'vframes' (set the number of
video frames to output) with argument '1'.
Reading option '-y' ... matched as option 'y' (overwrite output files) with
argument '1'.
Reading option '/home2/public_html/ffmpeg/SampleVideo.png' ... matched as
output url.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging
level) with argument 'debug'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option y (overwrite output files) with argument 1.
Applying option loglevel (set logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input url
/home2/public_html/ffmpeg/SampleVideo.mp4.
Successfully parsed a group of options.
Opening an input file: /home2/public_html/ffmpeg/SampleVideo.mp4.
[NULL @ 0x58c0c00] Opening '/home2/public_html/ffmpeg/SampleVideo.mp4' for
reading
[file @ 0x58c1500] Setting default whitelist 'file,crypto'
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x58c0c00] Format mov,mp4,m4a,3gp,3g2,mj2 probed
with size=2048 and score=100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x58c0c00] ISO: File Type Major Brand: isom
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x58c0c00] Unknown dref type 0x206c7275 size 12
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x58c0c00] Processing st: 0, edit list 0 - media
time: 0, duration: 172544
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x58c0c00] Unknown dref type 0x206c7275 size 12
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x58c0c00] Processing st: 1, edit list 0 - media
time: 0, duration: 648192
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x58c0c00] Before avformat_find_stream_info()
pos: 2107842 bytes read:41625 seeks:1 nb_streams:2
[h264 @ 0x58c2580] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0x58c2580] nal_unit_type: 8, nal_ref_idc: 3
[h264 @ 0x58c2580] nal_unit_type: 5, nal_ref_idc: 3
[h264 @ 0x58c2580] Format yuv420p chosen by get_format().
[h264 @ 0x58c2580] Reinit context to 1280x720, pix_fmt: yuv420p
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x58c0c00] All info found
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x58c0c00] After avformat_find_stream_info() pos:
106237 bytes read:147814 seeks:2 frames:2
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from
'/home2/public_html/ffmpeg/SampleVideo.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    creation_time   : 1970-01-01T00:00:00.000000Z
    encoder         : Lavf53.24.2
  Duration: 00:00:13.50, start: 0.000000, bitrate: 1248 kb/s
    Stream #0:0(und), 1, 1/12800: Video: h264 (Main), 1 reference frame
(avc1 / 0x31637661), yuv420p(left), 1280x720 [SAR 1:1 DAR 16:9], 0/1, 862
kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
    Metadata:
      creation_time   : 1970-01-01T00:00:00.000000Z
      handler_name    : VideoHandler
    Stream #0:1(und), 1, 1/48000: Audio: aac (LC) (mp4a / 0x6134706D), 48000
Hz, 5.1, fltp, 381 kb/s (default)
    Metadata:
      creation_time   : 1970-01-01T00:00:00.000000Z
      handler_name    : SoundHandler
Successfully opened the file.
Parsing a group of options: output url
/home2/public_html/ffmpeg/SampleVideo.png.
Applying option ss (set the start time offset) with argument 00:00:01.000.
Applying option vframes (set the number of video frames to output) with
argument 1.
Successfully parsed a group of options.
Opening an output file: /home2/public_html/ffmpeg/SampleVideo.png.
Successfully opened the file.
detected 20 logical cores
[h264 @ 0x58c8ac0] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0x58c8ac0] nal_unit_type: 8, nal_ref_idc: 3
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> png (native))
Press [q] to stop, [?] for help
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
    Last message repeated 2 times
[h264 @ 0x58c8ac0] nal_unit_type: 5, nal_ref_idc: 3
[h264 @ 0x58c8ac0] Format yuv420p chosen by get_format().
[h264 @ 0x58c8ac0] Reinit context to 1280x720, pix_fmt: yuv420p
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
[h264 @ 0x58e3800] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
[h264 @ 0x5961840] nal_unit_type: 1, nal_ref_idc: 2
[h264 @ 0x597dc00] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
    Last message repeated 1 times
[h264 @ 0x599a2c0] nal_unit_type: 1, nal_ref_idc: 2
[h264 @ 0x59b6700] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
[h264 @ 0x59d2b40] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
[h264 @ 0x59eef80] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
    Last message repeated 1 times
[h264 @ 0x5a0b700] nal_unit_type: 1, nal_ref_idc: 2
[h264 @ 0x5a27e40] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
    Last message repeated 1 times
[h264 @ 0x5a44580] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
[h264 @ 0x5a60c80] nal_unit_type: 1, nal_ref_idc: 2
[h264 @ 0x5a7d3c0] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
    Last message repeated 1 times
[h264 @ 0x5a99b00] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
[h264 @ 0x5ab6240] nal_unit_type: 1, nal_ref_idc: 2
[h264 @ 0x5ad28c0] nal_unit_type: 1, nal_ref_idc: 2
[graph 0 input from stream 0:0 @ 0x60646c0] Setting 'video_size' to value
'1280x720'
[graph 0 input from stream 0:0 @ 0x60646c0] Setting 'pix_fmt' to value '0'
[graph 0 input from stream 0:0 @ 0x60646c0] Setting 'time_base' to value
'1/12800'
[graph 0 input from stream 0:0 @ 0x60646c0] Setting 'pixel_aspect' to value
'1/1'
[graph 0 input from stream 0:0 @ 0x60646c0] Setting 'sws_param' to value
'flags=2'
[graph 0 input from stream 0:0 @ 0x60646c0] Setting 'frame_rate' to value
'25/1'
[graph 0 input from stream 0:0 @ 0x60646c0] w:1280 h:720 pixfmt:yuv420p
tb:1/12800 fr:25/1 sar:1/1 sws_param:flags=2
[format @ 0x6064580] Setting 'pix_fmts' to value
'rgb24|rgba|rgb48be|rgba64be|pal8|gray|ya8|gray16be|ya16be|monob'
[auto_scaler_0 @ 0x6064b80] Setting 'flags' to value 'bicubic'
[auto_scaler_0 @ 0x6064b80] w:iw h:ih flags:'bicubic' interl:0
[format @ 0x6064580] auto-inserting filter 'auto_scaler_0' between the
filter 'Parsed_null_0' and the filter 'format'
[AVFilterGraph @ 0x590ff80] query_formats: 5 queried, 3 merged, 1 already
done, 0 delayed
[auto_scaler_0 @ 0x6064b80] picking rgb24 out of 9 ref:yuv420p alpha:0
[auto_scaler_0 @ 0x6064b80] w:1280 h:720 fmt:yuv420p sar:1/1 -> w:1280 h:720
fmt:rgb24 sar:1/1 flags:0x4
[png @ 0x58db680] ff_frame_thread_encoder_init failed
Error initializing output stream 0:0 -- Error while opening encoder for
output stream #0:0 - maybe incorrect parameters such as bit_rate, rate,
width or height
[AVIOContext @ 0x58c9940] Statistics: 246118 bytes read, 2 seeks
Conversion failed!




--
Sent from: http://www.ffmpeg-archive.org/
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: ff_frame_thread_encoder_init failed when run via PHP exec

Moritz Barsnick
On Sat, Jun 23, 2018 at 04:39:27 -0700, rwilkin wrote:
> I am very new to ffmpeg, so sorry if this is a silly question.

Not at all.

> It works perfectly when I log in to the console via putty and run it. But
> when I run it via exec() in PHP it always comes back with
> ff_frame_thread_encoder_init failed Error initializing output stream 0:0 --
> Error while opening encoder for output stream #0:0 - maybe incorrect
> parameters such as bit_rate, rate, width or height.

The same is described here, without solution:
https://stackoverflow.com/q/11378081

Running under PHP, is there some restriction on the number of threads a
process is allowed to use? (I'm guessing that's what the function's
name implies, that it is trying to spawn a thread.)

Or perhaps on memory usage? Though I would expect ffmpeg to give a
clearer error message.

Cheers,
Moritz
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: ff_frame_thread_encoder_init failed when run via PHP exec

André Hänsel
> > It works perfectly when I log in to the console via putty and run it. But
> > when I run it via exec() in PHP it always comes back with
> > ff_frame_thread_encoder_init failed Error initializing output stream 0:0 --
> > Error while opening encoder for output stream #0:0 - maybe incorrect
> > parameters such as bit_rate, rate, width or height.

Could you try running "ulimit -a", once on the console and once from PHP?

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: ff_frame_thread_encoder_init failed when run via PHP exec

Carl Eugen Hoyos-2
In reply to this post by rwilkin
2018-06-23 13:39 GMT+02:00, rwilkin <[hidden email]>:

> I am trying to create a thumbnail image from a video with PHP. This is the
> command I am using:
>
> "/home2/public_html/ffmpeg/ffmpeg" -i
> "/home2/public_html/ffmpeg/SampleVideo.mp4" -ss 00:00:01.000 -vframes 1 -y
> "/home2/public_html/ffmpeg/SampleVideo.png" -loglevel debug 2>
> "/home2/public_html/ffmpeg/wildlife.txt"

Assuming the issue is a limit on the number of threads (and
you cannot increase the number), try:
$ ffmpeg -threads 1 -i SampleVideo.mp4 -ss 1 ...

Test different numbers.

Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: ff_frame_thread_encoder_init failed when run via PHP exec

rwilkin
In reply to this post by André Hänsel
Sorry for the delay in reply.
I ran ffmpeg with ulimit -a but it comes back with unrecognized option 'a'
It does that with both PHP and terminal.

ffmpeg version 4.0.1-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg
  libavutil      56. 14.100 / 56. 14.100
  libavcodec     58. 18.100 / 58. 18.100
  libavformat    58. 12.100 / 58. 12.100
  libavdevice    58.  3.100 / 58.  3.100
  libavfilter     7. 16.100 /  7. 16.100
  libswscale      5.  1.100 /  5.  1.100
  libswresample   3.  1.100 /  3.  1.100
  libpostproc    55.  1.100 / 55.  1.100
Splitting the commandline.
Reading option 'ulimit' ... matched as output url.
Reading option '-a' ...Unrecognized option 'a'.
Error splitting the argument list: Option not found

________________________________
From: ffmpeg-user <[hidden email]> on behalf of André Hänsel <[hidden email]>
Sent: Tuesday, 26 June 2018 7:59 PM
To: 'FFmpeg user questions'
Subject: Re: [FFmpeg-user] ff_frame_thread_encoder_init failed when run via PHP exec

> > It works perfectly when I log in to the console via putty and run it. But
> > when I run it via exec() in PHP it always comes back with
> > ff_frame_thread_encoder_init failed Error initializing output stream 0:0 --
> > Error while opening encoder for output stream #0:0 - maybe incorrect
> > parameters such as bit_rate, rate, width or height.

Could you try running "ulimit -a", once on the console and once from PHP?

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: ff_frame_thread_encoder_init failed when run via PHP exec

rwilkin
In reply to this post by Carl Eugen Hoyos-2
Running it with -threads 1 in the terminal works but with PHP I get the same error:

ffmpeg version 4.0.1-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg
  libavutil      56. 14.100 / 56. 14.100
  libavcodec     58. 18.100 / 58. 18.100
  libavformat    58. 12.100 / 58. 12.100
  libavdevice    58.  3.100 / 58.  3.100
  libavfilter     7. 16.100 /  7. 16.100
  libswscale      5.  1.100 /  5.  1.100
  libswresample   3.  1.100 /  3.  1.100
  libpostproc    55.  1.100 / 55.  1.100
Splitting the commandline.
Reading option '-threads' ... matched as AVOption 'threads' with argument '1'.
Reading option '-i' ... matched as input url with argument '/home2/public_html/ffmpeg/SampleVideo.mp4'.
Reading option '-ss' ... matched as option 'ss' (set the start time offset) with argument '00:00:01.000'.
Reading option '-vframes' ... matched as option 'vframes' (set the number of video frames to output) with argument '1'.
Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'.
Reading option '/home2/public_html/ffmpeg/SampleVideo.png' ... matched as output url.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option y (overwrite output files) with argument 1.
Applying option loglevel (set logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input url /home2/public_html/ffmpeg/SampleVideo.mp4.
Successfully parsed a group of options.
Opening an input file: /home2/public_html/ffmpeg/SampleVideo.mp4.
[NULL @ 0x501fcc0] Opening '/home2/public_html/ffmpeg/SampleVideo.mp4' for reading
[file @ 0x50205c0] Setting default whitelist 'file,crypto'
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x501fcc0] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x501fcc0] ISO: File Type Major Brand: mp42
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x501fcc0] Unknown dref type 0x206c7275 size 12
    Last message repeated 1 times
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x501fcc0] Before avformat_find_stream_info() pos: 383523 bytes read:36359 seeks:1 nb_streams:2
[h264 @ 0x5021600] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0x5021600] nal_unit_type: 8, nal_ref_idc: 3
[h264 @ 0x5021600] nal_unit_type: 6, nal_ref_idc: 0
[h264 @ 0x5021600] nal_unit_type: 5, nal_ref_idc: 3
[h264 @ 0x5021600] Format yuv420p chosen by get_format().
[h264 @ 0x5021600] Reinit context to 560x320, pix_fmt: yuv420p
[h264 @ 0x5021600] nal_unit_type: 1, nal_ref_idc: 2
    Last message repeated 2 times
[aac @ 0x50277c0] skip whole frame, skip left: 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x501fcc0] All info found
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x501fcc0] After avformat_find_stream_info() pos: 28292 bytes read:69127 seeks:2 frames:5
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home2/public_html/ffmpeg/SampleVideo.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42isomavc1
    creation_time   : 2010-03-20T21:29:11.000000Z
    encoder         : HandBrake 0.9.4 2009112300
  Duration: 00:00:05.57, start: 0.000000, bitrate: 551 kb/s
    Stream #0:0(und), 4, 1/90000: Video: h264 (Constrained Baseline), 1 reference frame (avc1 / 0x31637661), yuv420p(tv, bt709, left), 560x320, 0/1, 465 kb/s, 30 fps, 30 tbr, 90k tbn, 60 tbc (default)
    Metadata:
      creation_time   : 2010-03-20T21:29:11.000000Z
      encoder         : JVT/AVC Coding
    Stream #0:1(eng), 1, 1/48000: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 83 kb/s (default)
    Metadata:
      creation_time   : 2010-03-20T21:29:11.000000Z
Successfully opened the file.
Parsing a group of options: output url /home2/public_html/ffmpeg/SampleVideo.png.
Applying option ss (set the start time offset) with argument 00:00:01.000.
Applying option vframes (set the number of video frames to output) with argument 1.
Successfully parsed a group of options.
Opening an output file: /home2/public_html/ffmpeg/SampleVideo.png.
Successfully opened the file.
[h264 @ 0x5139940] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0x5139940] nal_unit_type: 8, nal_ref_idc: 3
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> png (native))
Press [q] to stop, [?] for help
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[h264 @ 0x5139940] nal_unit_type: 6, nal_ref_idc: 0
[h264 @ 0x5139940] nal_unit_type: 5, nal_ref_idc: 3
[h264 @ 0x5139940] Format yuv420p chosen by get_format().
[h264 @ 0x5139940] Reinit context to 560x320, pix_fmt: yuv420p
detected 20 logical cores
[graph 0 input from stream 0:0 @ 0x5048300] Setting 'video_size' to value '560x320'
[graph 0 input from stream 0:0 @ 0x5048300] Setting 'pix_fmt' to value '0'
[graph 0 input from stream 0:0 @ 0x5048300] Setting 'time_base' to value '1/90000'
[graph 0 input from stream 0:0 @ 0x5048300] Setting 'pixel_aspect' to value '0/1'
[graph 0 input from stream 0:0 @ 0x5048300] Setting 'sws_param' to value 'flags=2'
[graph 0 input from stream 0:0 @ 0x5048300] Setting 'frame_rate' to value '30/1'
[graph 0 input from stream 0:0 @ 0x5048300] w:560 h:320 pixfmt:yuv420p tb:1/90000 fr:30/1 sar:0/1 sws_param:flags=2
[format @ 0x5105c80] Setting 'pix_fmts' to value 'rgb24|rgba|rgb48be|rgba64be|pal8|gray|ya8|gray16be|ya16be|monob'
[auto_scaler_0 @ 0x5049e40] Setting 'flags' to value 'bicubic'
[auto_scaler_0 @ 0x5049e40] w:iw h:ih flags:'bicubic' interl:0
[format @ 0x5105c80] auto-inserting filter 'auto_scaler_0' between the filter 'Parsed_null_0' and the filter 'format'
[AVFilterGraph @ 0x5105b80] query_formats: 5 queried, 3 merged, 1 already done, 0 delayed
[auto_scaler_0 @ 0x5049e40] picking rgb24 out of 9 ref:yuv420p alpha:0
[auto_scaler_0 @ 0x5049e40] w:560 h:320 fmt:yuv420p sar:0/1 -> w:560 h:320 fmt:rgb24 sar:0/1 flags:0x4
[png @ 0x504c0c0] ff_frame_thread_encoder_init failed
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
[AVIOContext @ 0x50289c0] Statistics: 69127 bytes read, 2 seeks
Conversion failed!

________________________________
From: ffmpeg-user <[hidden email]> on behalf of Carl Eugen Hoyos <[hidden email]>
Sent: Wednesday, 27 June 2018 7:10 AM
To: FFmpeg user questions
Subject: Re: [FFmpeg-user] ff_frame_thread_encoder_init failed when run via PHP exec

2018-06-23 13:39 GMT+02:00, rwilkin <[hidden email]>:

> I am trying to create a thumbnail image from a video with PHP. This is the
> command I am using:
>
> "/home2/public_html/ffmpeg/ffmpeg" -i
> "/home2/public_html/ffmpeg/SampleVideo.mp4" -ss 00:00:01.000 -vframes 1 -y
> "/home2/public_html/ffmpeg/SampleVideo.png" -loglevel debug 2>
> "/home2/public_html/ffmpeg/wildlife.txt"

Assuming the issue is a limit on the number of threads (and
you cannot increase the number), try:
$ ffmpeg -threads 1 -i SampleVideo.mp4 -ss 1 ...

Test different numbers.

Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: ff_frame_thread_encoder_init failed when run via PHP exec

André Hänsel
In reply to this post by rwilkin
> I ran ffmpeg with ulimit -a but it comes back with unrecognized option 'a'

Not ffmpeg, just "ulimit -a". It will show you the current resource limits that are set in that environment. PHP might set some and then you will see it in the output.

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: ff_frame_thread_encoder_init failed when run via PHP exec

rwilkin
Ah, sorry.

ulimit -a from terminal:
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 5
file size               (blocks, -f) unlimited
pending signals                 (-i) 120594
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) 262144
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 100
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

ulimit -a from PHP:
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 20
file size               (blocks, -f) unlimited
pending signals                 (-i) 120594
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 16384
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) 150
max user processes              (-u) 60
virtual memory          (kbytes, -v) 976562
file locks                      (-x) unlimited

________________________________
From: ffmpeg-user <[hidden email]> on behalf of Andr? H?nsel <[hidden email]>
Sent: Wednesday, 27 June 2018 3:22 PM
To: 'FFmpeg user questions'
Subject: Re: [FFmpeg-user] ff_frame_thread_encoder_init failed when run via PHP exec

> I ran ffmpeg with ulimit -a but it comes back with unrecognized option 'a'

Not ffmpeg, just "ulimit -a". It will show you the current resource limits that are set in that environment. PHP might set some and then you will see it in the output.

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: ff_frame_thread_encoder_init failed when run via PHP exec

rwilkin
Sorry, I didn't realise I was top posting. I was just replying to the emails.

Is there any other suggestions to what I can try?



--
Sent from: http://www.ffmpeg-archive.org/
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".