[FFmpeg-user] ff_frame_thread_encoder_init failed when run via PHP exec

Robert Wilkin robertwilkin1983 at hotmail.com
Wed Jun 27 06:03:51 EEST 2018


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 <ffmpeg-user-bounces at ffmpeg.org> on behalf of Carl Eugen Hoyos <ceffmpeg at gmail.com>
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 <robertwilkin1983 at hotmail.com>:

> 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
ffmpeg-user at ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-user mailing list