Ffmpeg hanging in a remote task when trying to convert a .MP4 file to .H265 file

Hi all! I’m new to Ray and I’ve stumbled upon an issue where my process is hanging when running an ffmpeg command to convert a .MP4 file into a .H265 file in my remote task. However, I’m able to convert a .H264 file into a .H265 in my remote task (exact same command). The problematic conversion runs successfully without using ray. Would appreciate any help on this issue if you have run into something similar or have some ideas. Thanks!

Command:

ffmpeg_command = [
        "ffmpeg",
        "-v", "error",
        "-i", input_video_path,
        "-vsync", "vfr",
        "-c:v", "libx265",
        "-crf", "26",
        "-g", "30",
        "-bf", "0",
        "-an",
        output_video_path,
    ]

Exception:

[2025-07-05 17:29:24,402 E 153295 153398] gcs_rpc_client.h:193: Failed to connect to GCS within 60 seconds. GCS may have been killed. It's either GCS is terminated by `ray stop` or is killed unexpectedly. If it is killed unexpectedly, see the log file gcs_server.out. https://docs.ray.io/en/master/ray-observability/user-guides/configure-logging.html#logging-directory-structure. The program will terminate.
[2025-07-05 17:29:24,403 E 153295 153389] gcs_rpc_client.h:193: Failed to connect to GCS within 60 seconds. GCS may have been killed. It's either GCS is terminated by `ray stop` or is killed unexpectedly. If it is killed unexpectedly, see the log file gcs_server.out. https://docs.ray.io/en/master/ray-observability/user-guides/configure-logging.html#logging-directory-structure. The program will terminate.

Ray initialization:

ray start --head --resources='{"worker_node_units": 2}' --num-cpus=2

Things I have tried

  1. Increasing CPU and memory
  2. Multiple threads in the command
  3. Tried converting the .MP4 file to .h264 instead of .h265
  4. Making the conversion logic its own remote task (so nested remote tasks)