Video unavailable from windows agent running wptagent

I have a Windows server running wptagent and it seems to be mostly working. My test results show a screenshot, they have the waterfall chart and almost all of the data that we are interested in. However the speed index and the video (I’ve learned they are related) are missing. I’ve spent a lot of time reading the debug output from wptagent and I’m not seeing any errors related to recording video. I even spent time digging into the python code to copy some of the assets onto the Desktop so I can inspect the contents. The file does not have any video in it. ffmpeg appears to be running fine. When I manually run the same ffmpeg command that is run by wptagent I can save an mp4 video recording of the screen without any issues.

At this point I don’t know if the issue is on the windows agent or if it is the web server. Since the file did not contain a video I assume that it is the windows agent.

I’m not sure where else to look at this point. I’m semi-familiar with the python code but not enough to pin point where the issue is happening.

Usually this will happen if the desktop is locked. Does it also fail if you are running the agent while you are logged in and looking at the machine? If you RDP to the machine and disconnect (instead of rebooting) the display will also lock and break video.

It’s definitely on the agent side. All of the video capture, processing and analysis is done on the agent.

One other possibility that I have seen is path issues and a conflict with the ffmpeg installed by Image Magick. I usually download the ffmpeg static build and copy it over the ffmpeg in the image magick install directory to make sure that isn’t a problem.

Video does fail after a fresh reboot without an RDP session as well as when I’m logged in and looking at the machine. What is interesting is when I run ffmpeg -f gdigrab -video_size 1024x768 -framerate 10 -draw_mouse 0 -i desktop -codec:v libx264rgb -crf 0 -preset ultrafast C:\test.mp4 I am able to record a video. I’ll check the image magick path now.

I replaced the ffmpeg.exe that was in the ImageMagick folder with the static build and I am getting the same result.

I’ve updated this line to place the video on the desktop and it does record video

I also see “Video file size: 262192” in the debug output

As I read the code I was wondering a couple of things:

  1. The video is not intended to be included in the .zip file, is that correct?
  2. For some reason I’m not seeing the video being uploaded separately when I log all of the post_data calls…

This is really puzzling at this point
I don’t see any posts in the post_data log to resultimage.php in the log, is that suspect? :dodgy:

A new clue!
When I comment out this line I get a video but it’s blank:

It seems whatever is going on in might be related to my issue? I have been able to see the original mp4 recorded by ffmpeg and it looks fine. Something weird happens when it is passed to

Running python -c gives me:
ffmpeg: OK
convert: OK
compare: OK
Pillow: OK
I saw a lot of imagemagick commands being called from visualmetrics so I decided to re-install it… Solved it!

I’m 99.9% sure it’s a ffmpeg version issue and the detection check isn’t detecting that the decimate filter is not working correctly. That is behaving pretty much how it was when I had ffmpeg issues. It correctly records but when it extracts the video frames it only gets a single frame.

Grab the latest static build from here:

Find every copy of ffmpeg.exe on your system and replace it with the version from the zip.

Profit (hopefully)

I may need to bundle the build with the agent just to be safe.

FWIW, you probably figured it out already but the videos are not uploaded. The agent records the video and passes it to visualmetrics. visualmetrics extracts the frames where something actually changed, crops it to the viewport and calculates a bunch of metrics then the agent uploads the individual frames that were extracted. It’s the extraction that is failing (which uses ffmpeg).

Thanks for the reply! I’m not sure exactly what it was. I replaced ffmpeg with a static build and I was still having issues. Once I updated ImageMagick and again replaced ffmpeg with the static build it started working. I’m just writing in case anyone else experiences this issue and simply replacing ffmpeg doesn’t resolve it, maybe replace both.

On the bright side I’m super familiar with the python code in wptagent now :slight_smile:

Thanks for the updates and replies on this thread. I am seeing similar issues and will try the workarounds/fixes suggested.