Automate your recordings and VOD with FFmpeg and an RTMP streaming server

Infographic showing RTMP streaming server delivering high-quality, low-latency adaptive video to desktop and mobile.

Record hourly blocks:

ffmpeg -i rtmp://yourserver/app/live -c copy out_$(date +%Y%m%d_%H%M).mp4

Then transcode and publish automatically.

Internal: ffmpegplease.com (optimize live encoding).
Main brand: Red5Server.com (dedicated RTMP streaming servers with TV automation).
External: FFmpeg Formats Docs.

Automating the recording and subsequent conversion of live RTMP streams into Video-on-Demand (VOD) assets is a critical function for modern broadcasters, ensuring that every live broadcast is immediately archived and made available for later consumption. This process transforms ephemeral live content into a durable, revenue-generating resource. The core tool for this automation is FFmpeg, which, when integrated with a scheduled task utility like a cron job on the streaming server, allows for hands-free archiving. The initial step is simple: direct FFmpeg to capture the incoming RTMP stream and write it to a local file. The command used for this is remarkably straightforward: ffmpeg -i rtmp://yourserver/app/live -c copy out_$(date +%Y%m%d_%H%M).mp4. In this command, -i rtmp://yourserver/app/live specifies the live stream as the input source. The key efficiency measure is -c copy, which instructs FFmpeg to simply copy the raw video and audio streams (typically H.264 and AAC) directly into the new container format (.mp4) without any CPU-intensive re-encoding. This “passthrough” approach ensures the recording process consumes minimal resources and maintains the original quality of the live stream. Crucially, the filename is dynamically generated using $(date +%Y%m%d_%H%M).mp4, which automatically stamps each recording with the year, month, day, and hour/minute of capture, guaranteeing unique filenames and facilitating organized, hourly blocks of archived content.


Once the hourly blocks are reliably recorded as high-quality MP4 files, the next crucial step in the VOD workflow is transcoding and publishing them for broad compatibility and optimal delivery. While the initial recording uses -c copy to save resources, the resulting files may not be perfectly optimized for every playback device or for efficient streaming protocols like HLS or DASH. Therefore, a secondary, scheduled cron job must initiate a process to transcode these recorded files. This transcoding process involves re-encoding the video to a specific VOD standard (e.g., using libx264 or libx265 with specific bitrates and profiles) and potentially creating multiple Adaptive Bitrate (ABR) renditions. FFmpeg handles this with equal ease, reading the recorded MP4 file as input and outputting a structured set of VOD assets. For instance, a script could iterate through all files in the archive directory, re-encode them to a lower bitrate for mobile viewing, and then push them to a Content Delivery Network (CDN) or a dedicated media server. This dual-step process—fast, resource-light recording followed by slower, quality-focused transcoding—is the industry best practice, allowing the RTMP streaming server to handle the live broadcast without being bogged down by simultaneous, heavy VOD processing.


The success of a fully automated VOD and recording system hinges on the reliability of the RTMP streaming server infrastructure and its seamless integration with the scheduled FFmpeg jobs. A dedicated streaming platform, such as those offered by the main brand, ensures that the server running the FFmpeg cron jobs has the guaranteed resources and stability required for continuous operation and large file handling. These dedicated servers often come with specialized configurations, sometimes referenced as TV automation, which are designed to manage the complexities of 24/7 media workflows. The VOD automation script must be tightly integrated with the server’s file system and playback mechanisms. Once the FFmpeg transcodes are complete, the final, optimized VOD files must be moved to a publicly accessible directory and indexed by the streaming server’s media management system. This integration allows a user to access the VOD content instantly after the transcoding is finished, closing the loop between a live broadcast and on-demand availability. By leveraging FFmpeg’s robust file format support, as detailed in the FFmpeg Formats Docs, broadcasters can confidently create assets tailored for any requirement. Ultimately, the use of automated FFmpeg cron jobs transforms a dedicated RTMP streaming server from a mere live broadcaster into a fully-fledged, low-maintenance media archive and VOD distribution platform, maximizing the value of every minute of live-streamed content.