Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto encoding and Video Encode Queue is off while FFMPEG is recognised. #349

Closed
gaborkukucska opened this issue Jun 8, 2016 · 3 comments
Assignees

Comments

@gaborkukucska
Copy link

gaborkukucska commented Jun 8, 2016

Hi Kyle,

Encoding does not run via wp-cron, but even if I try to run it manually by pressing the "encode videos" button, it just times out. Also the Video Encode Queue under the tools menu never opens, just loads forever...

Nginx error on front end instance (every second till I killed it):
2016/06/08 14:27:03 [error] 1248#0: *14642 upstream timed out (110: Connection timed out) while reading response header from upstream, client: xxx.xxx.xxx.xxx, server: mysite.com, request: "POST /wp-admin/admin-ajax.php HTTP/2.0", upstream: "https://xxx.xxx.xxx.xxx:443/wp-admin/admin-ajax.php", host: "www.mysite.com", referrer: "https://www.mysite.com/wp-admin/options-general.php?page=video-embed-thumbnail-generator%2Fvideo-embed-thumbnail-generator.php"

It is probably something to do with the way how my servers are setup. I have slave servers in an ASG behind a load balancer facing the net, with the master instance outside of the ASG. all /wp-admin/ browsing redirects to the master server while non admin traffic is served by the slaves. All dynamic data is stored on s3 and the database is on a separate instance too as the front end can scale. Servers are all ubuntu - nginx - php fpm setups.

Q: Any ideas? Also, is there a way to perhaps start the queue by a server cron job?

Thanks!!!

Below is my ffmpeg test field output:
ffmpeg version N-78986-ga62d768 Copyright (c) 2000-2016 the FFmpeg developers built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.1) configuration: --prefix=/home/tomanderson/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/tomanderson/ffmpeg_build/include --extra-ldflags=-L/home/tomanderson/ffmpeg_build/lib --bindir=/home/tomanderson/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree libavutil 55. 19.100 / 55. 19.100 libavcodec 57. 28.100 / 57. 28.100 libavformat 57. 28.100 / 57. 28.100 libavdevice 57. 0.101 / 57. 0.101 libavfilter 6. 39.102 / 6. 39.102 libswscale 4. 0.100 / 4. 0.100 libswresample 2. 0.101 / 2. 0.101 libpostproc 54. 0.100 / 54. 0.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/var/www/wp-content/plugins/video-embed-thumbnail-generator/images/sample-video-h264.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf55.33.100 Duration: 00:00:01.02, start: 0.021333, bitrate: 123 kb/s Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 109 kb/s, 23.98 fps, 23.98 tbr, 11988 tbn, 47.95 tbc (default) Metadata: handler_name : VideoHandler Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 2 kb/s (default) Metadata: handler_name : SoundHandler Input #1, png_pipe, from '/var/www/wp-content/uploads/2016/06/watermark-white.png': Duration: N/A, bitrate: N/A Stream #1:0: Video: png, pal8(pc), 2627x3192, 25 tbr, 25 tbn, 25 tbc [libx264 @ 0x3c2aea0] using SAR=1/1 [libx264 @ 0x3c2aea0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 [libx264 @ 0x3c2aea0] profile High, level 4.0 [libx264 @ 0x3c2aea0] 264 - core 142 r2389 956c8d8 - 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=6 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=23 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/wp-content/uploads/2016/06/sample-video-h264-1080.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf57.28.100 Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 23.98 fps, 11988 tbn, 23.98 tbc (default) Metadata: encoder : Lavc57.28.100 libx264 Side data: cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1 Stream #0:1(eng): Audio: aac (libfdk_aac) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, s16, 160 kb/s (default) Metadata: handler_name : SoundHandler encoder : Lavc57.28.100 libfdk_aac Stream mapping: Stream #0:0 (h264) -> overlay:main (graph 0) Stream #1:0 (png) -> scale (graph 0) overlay (graph 0) -> Stream #0:0 (libx264) Stream #0:1 -> #0:1 (aac (native) -> aac (libfdk_aac)) Press [q] to stop, [?] for help [mp4 @ 0x3c2a400] Starting second pass: moving the moov atom to the beginning of the file frame= 25 fps= 23 q=-1.0 Lsize= 45kB time=00:00:01.02 bitrate= 359.2kbits/s dup=1 drop=0 speed=0.946x video:22kB audio:21kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 4.636395% [libx264 @ 0x3c2aea0] frame I:1 Avg QP:16.15 size: 19021 [libx264 @ 0x3c2aea0] frame P:6 Avg QP:14.14 size: 189 [libx264 @ 0x3c2aea0] frame B:18 Avg QP:12.67 size: 98 [libx264 @ 0x3c2aea0] consecutive B-frames: 4.0% 0.0% 0.0% 96.0% [libx264 @ 0x3c2aea0] mb I I16..4: 41.7% 50.1% 8.1% [libx264 @ 0x3c2aea0] mb P I16..4: 0.0% 0.0% 0.0% P16..4: 0.2% 0.0% 0.0% 0.0% 0.0% skip:99.7% [libx264 @ 0x3c2aea0] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 0.3% 0.0% 0.0% direct: 0.0% skip:99.7% L0:51.1% L1:48.9% BI: 0.0% [libx264 @ 0x3c2aea0] 8x8 transform intra:50.0% inter:9.4% [libx264 @ 0x3c2aea0] coded y,uvDC,uvAC intra: 4.6% 0.1% 0.0% inter: 0.0% 0.0% 0.0% [libx264 @ 0x3c2aea0] i16 v,h,dc,p: 94% 2% 4% 0% [libx264 @ 0x3c2aea0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 55% 4% 42% 0% 0% 0% 0% 0% 0% [libx264 @ 0x3c2aea0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 52% 18% 10% 4% 2% 5% 2% 4% 3% [libx264 @ 0x3c2aea0] i8c dc,h,v,p: 100% 0% 0% 0% [libx264 @ 0x3c2aea0] Weighted P-Frames: Y:0.0% UV:0.0% [libx264 @ 0x3c2aea0] ref P L0: 93.2% 2.8% 2.4% 1.6% [libx264 @ 0x3c2aea0] ref B L0: 44.7% 54.9% 0.4% [libx264 @ 0x3c2aea0] ref B L1: 99.6% 0.4% [libx264 @ 0x3c2aea0] kb/s:168.12

@kylegilman
Copy link
Owner

The WordPress AJAX script is timing out. Are you able to do other AJAX functions in WordPress with this setup? For example, is WordPress able to autosave posts while you're editing them? Do you get errors in your browser's developer console when you try to encode a video using the encode video button? Do you get PHP errors? Turn on wp_debug_log in your wp-config.php file to see if you're getting any WordPress PHP errors. The log goes to your wp-content folder.

// Enable WP_DEBUG mode
define( 'WP_DEBUG', true );

// Enable Debug logging to the /wp-content/debug.log file
define( 'WP_DEBUG_LOG', true );

// Disable display of errors and warnings 
define( 'WP_DEBUG_DISPLAY', false );

@kylegilman kylegilman self-assigned this Jun 8, 2016
@gaborkukucska
Copy link
Author

gaborkukucska commented Jun 8, 2016

Thanks for your quick response Kyle!

AJAX works however I've for example had to kill wp's hearthbeat function that autosaves posts as it was using too much resources at times...

Yes there are also 504 errors in the browser console when I manually execute.

load-scripts.php?c=0&load[]=jquery-core,jquery-migrate,utils,plupload,jquery-ui-core,jquery-ui-widg…:4 POST https://www.mysite.com/wp-admin/admin-ajax.php 504 ()

I have a few unrelated notices in php-fpm and the wordpress debug log but nothing relating to this issue.

I've now added a new block to nginx:
location /wp-admin/admin-ajax.php { allow all; }

I'll keep on trying ... any more ideas let me know. Thanks heaps!!

Gabor

@gaborkukucska
Copy link
Author

I've also noticed that if I view the newly uploaded video via the media menu, in the attachment details popup in the Thumbnails section it says:

Can't open movie file. sh: 1: /home/myuser/bin/ffmpeg: not found

which is strange as ffmpeg is there and being found by the admin page ... or does this mean the actual file is not found?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants