{"library":"imageio-ffmpeg","code":"import imageio_ffmpeg as iio_ffmpeg\nimport numpy as np\n\n# Define video parameters\nfilename = 'my_video_output.mp4'\nwidth, height = 640, 480\nfps = 30\nnum_frames = 100\n\nprint(f\"Using FFMPEG executable: {iio_ffmpeg.get_ffmpeg_exe()}\")\n\ntry:\n    # Initialize the writer\n    writer = iio_ffmpeg.write_frames(filename, (width, height), fps=fps)\n    writer.send(None)  # Start the pipe\n\n    for i in range(num_frames):\n        # Create a simple frame: black background with a moving red square\n        frame = np.zeros((height, width, 3), dtype=np.uint8)\n        x_offset = (i * 5) % (width - 100) # Move square across width\n        frame[50:150, x_offset : x_offset + 100] = [255, 0, 0] # Red square\n        writer.send(frame)\n    \n    writer.close()\n    print(f\"Video saved to {filename}\")\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")\n    print(\"Ensure FFMPEG is correctly configured or its bundled binary is accessible.\")","lang":"python","description":"This quickstart demonstrates how to use `imageio-ffmpeg` to write a simple video file (e.g., an MP4 with a moving red square). It initializes a video writer, generates a series of NumPy arrays representing frames, and sends them to the FFMPEG process. It also shows how to check the FFMPEG executable path being used.","tag":null,"tag_description":null,"last_tested":"2026-04-24","results":[{"runtime":"python:3.10-alpine","exit_code":1},{"runtime":"python:3.10-slim","exit_code":1},{"runtime":"python:3.11-alpine","exit_code":1},{"runtime":"python:3.11-slim","exit_code":1},{"runtime":"python:3.12-alpine","exit_code":1},{"runtime":"python:3.12-slim","exit_code":1},{"runtime":"python:3.13-alpine","exit_code":1},{"runtime":"python:3.13-slim","exit_code":1},{"runtime":"python:3.9-alpine","exit_code":1},{"runtime":"python:3.9-slim","exit_code":1}]}