Skip to content
streamneo.
Setup Guides10 min read

How to Use FFmpeg on an Azure VM to Stream a Playlist to YouTube

Prepare a playlist on a Linux Azure VM, choose FFmpeg output settings, connect to YouTube RTMPS and protect your stream key.

sn.
StreamNeoPublished 4 October 2026
Worth sharing?

To stream a playlist from an Azure VM to YouTube, use FFmpeg on a Linux VM to read a manifest of media files in sequence, prepare a compatible live output, and send it to the RTMPS address and stream key shown in YouTube Live Control Room. The VM needs enough sustained outbound capacity for your chosen stream bitrate, and the clips need compatible streams or a suitable conversion step.

This is a VM-to-YouTube workflow, not an Azure Media Services deployment. An Azure Samples FFmpeg example may help illustrate command structure, but its documented context is Media Services live ingest; it is not evidence that the sample configures a VM to stream to YouTube. The outline and command below are illustrative, not a tested deployment.

Understand the playlist-to-YouTube workflow

There are four parts: media files stored where the VM can read them, a playlist manifest that gives their order, FFmpeg to read and prepare the stream, and YouTube's live ingest endpoint. The VM runs FFmpeg continuously while it reads the files and sends the resulting live stream over the network. You do not need Media Services for this basic path.

An Azure VM is useful when you want a Linux machine under your control and can manage its operating system, FFmpeg installation, process supervision and network access. You are also responsible for deciding what happens when the process exits or the VM restarts. VM size, region, licensing and price depend on workload and deployment details, so assess those against your actual media and current Azure information rather than assuming a particular size is right.

The headless Ubuntu VPS playlist walkthrough covers a similar general pattern. The Azure-specific point here is to keep the distinction clear: a VM running FFmpeg and sending to YouTube is not the same thing as an Azure Media Services workflow.

Prepare files and a manifest on the VM

Choose a Linux VM, place the source files on a filesystem FFmpeg can read, and install FFmpeg from a distribution or release source you trust. Check the installed build for the encoders and protocols you plan to use; available options can differ between builds. FFmpeg's command-line documentation explains how input options, stream selection, codecs and output options fit together.

Create a UTF-8 text file, for example playlist.ffconcat, in the working directory:

ffconcat version 1.0
file 'video-01.mp4'
file 'video-02.mp4'
file 'video-03.mp4'

The FFmpeg formats documentation describes the concat demuxer, which presents compatible files as one sequential input. Paths can be relative to the working directory or absolute. If a filename contains quotes, backslashes or other special characters, follow FFmpeg's escaping rules rather than assuming ordinary shell quoting is enough: the manifest has its own parsing rules.

Inspect the clips before scheduling a long run. Note whether each has video and audio, its codecs, frame dimensions, frame rate, sample rate and stream layout. The concat demuxer is most straightforward when inputs have matching stream structure and parameters. If one file has no audio, another has multiple audio tracks, or the clips use differing formats, mappings that work for one may not describe the others. Normalise or transcode the files to a consistent profile, or choose an appropriate filter workflow. The concat demuxer and concat filter comparison helps explain that distinction.

Choose stream-copy or encoding

With stream-copy, FFmpeg passes existing encoded audio and video through without decoding and re-encoding them. That can reduce CPU demand on the VM, but it only makes sense when the source formats, timestamps, stream layout and output requirements fit the ingest and the sequence behaves acceptably. It does not repair incompatible clips or create a new keyframe cadence just because a playlist needs one.

Transcoding decodes and re-encodes the selected streams. This uses more VM CPU, but gives you control over codec, resolution, frame rate, bitrate and audio format. It is usually the more practical starting point when clips differ or when you need a consistent output profile. It is not automatically better: check that the selected encoder exists in the installed build and that the VM can sustain the workload.

Choice What FFmpeg does Main trade-off
Stream-copy Passes through compatible encoded streams Lower encoding work, but limited control and stricter source compatibility
Transcode Decodes and re-encodes selected streams More control over output, at the cost of CPU and another lossy encode in many workflows

Do not assume that concatenated files will have seamless transitions merely because FFmpeg reaches them in order. Compare codec and stream properties, then test the joins for a brief gap, timestamp jump, missing audio or unexpected change in picture. If you need predictable transitions across heterogeneous clips, normalise them before the broadcast or use a workflow designed to reconcile their differences.

Set YouTube-compatible output parameters

YouTube's encoder settings guidance lists H.264, H.265 (HEVC) and AV1 video, AAC or MP3 audio, CBR, up to 60 frames per second, and a recommended keyframe frequency of two seconds, not exceeding four seconds. The right profile depends on the intended resolution and frame rate; those recommendations are not a promise that every source or VM configuration will work unchanged.

For a concrete reference, YouTube's settings table lists H.264 1080p at 30 fps with a recommended bitrate of 5 Mbps and a minimum of 4 Mbps. Use the table for the actual resolution and frame rate rather than copying that value for a different output. YouTube also advises choosing a stream quality that your connection can reliably send and testing upload capacity. Leave headroom rather than planning to use every bit of available outbound capacity for the video alone.

Keyframe interval relates to frame rate. At 30 fps, a two-second interval corresponds to 60 frames; with a different frame rate, derive the frame count from the intended interval. In an encode, GOP options such as -g and -keyint_min can help set cadence, but source changes, encoder behaviour and other options matter. With stream-copy, you cannot force the original encoded video to acquire a new cadence without re-encoding. Confirm the resulting stream against YouTube's current guidance and the live health indicators.

Audio needs deliberate handling too. Map the intended audio stream, and choose a supported codec and settings that match it. A manifest containing a clip without audio makes an unconditional audio mapping fragile; optional mapping syntax can help, but does not by itself ensure a consistent audio stream across every concat segment. Where audio is essential throughout, normalise the inputs or build a workflow that explicitly handles missing tracks.

Get the RTMPS URL and stream key

Create or open the live stream in YouTube Live Control Room and copy the current ingest URL and stream key shown for that stream. Prefer the RTMPS endpoint when YouTube offers it and your FFmpeg build supports it. YouTube explains that RTMPS is RTMP over a TLS/SSL connection; do not rely on a remembered endpoint from an old example, because the interface is the source for the current URL.

Treat the stream key as a password. Do not commit it to a public repository, include it in screenshots, or leave it in a script that other users can read. Putting a literal key in a shell command can also expose it through shell history or process inspection. Use a restricted configuration file or another secret-handling approach appropriate to the VM, keep permissions narrow, and avoid logging the full destination URL. If a key may have been exposed, replace it in the control room before using the stream again.

Check that outbound network access from the VM permits the connection to the chosen endpoint. YouTube documents port 443 as a troubleshooting option where appropriate to the endpoint; follow the current instructions for the endpoint actually shown rather than opening network access broadly without a reason. The VM's available throughput depends on deployment details, so validate it from the running setup rather than assuming an Azure-wide figure.

Run FFmpeg and observe the output

The following schematic command shows how the pieces fit together. It is an illustrative starting shape, not a tested command or universal configuration. Replace the destination placeholder with the actual RTMPS URL and secret key, adapt mappings to the media, and confirm that the installed FFmpeg build supports the selected protocol and encoders.

ffmpeg -re -f concat -safe 0 -i playlist.ffconcat \
  -map 0:v:0 -map 0:a:0? \
  -c:v libx264 -preset veryfast -pix_fmt yuv420p \
  -r 30 -g 60 -keyint_min 60 -sc_threshold 0 \
  -b:v 4500k -maxrate 4500k -bufsize 9000k \
  -c:a aac -b:a 128k -ar 44100 -ac 2 \
  -f flv 'rtmps://<YouTube-RTMPS-endpoint>/<stream-key>'

Here -re paces file input in real time rather than allowing FFmpeg to read ahead as quickly as possible. -f concat selects the manifest input demuxer, and -safe 0 permits absolute or otherwise non-default paths in a concat manifest. Only use that setting with a manifest you control. The -map expressions select the first video stream and an optional first audio stream; alter them if your playlist structure calls for something else. The codec, frame rate, GOP and bitrate options are examples, not values guaranteed to suit every source or resolution. The output muxer shown is FLV for the RTMP-family ingest workflow; use the protocol and output format supported by the live endpoint and your FFmpeg build.

Before a public broadcast, run a representative test, for example with an unlisted stream, and watch both the FFmpeg output and YouTube's stream health. Check that files play in the intended order, audio is present, transitions behave acceptably, and the connection remains stable at the chosen output settings. Test a clip ending and a process restart as well: neither is proof that a long unattended run will recover as you expect. YouTube's streaming tips recommend testing with audio and video motion like the real event and monitoring stream health.

If the inputs already have compatible streams, a stream-copy variant might replace the encoding options with -c copy. That is a decision to validate, not a shortcut to assume: copied streams retain their source characteristics, including keyframes and timestamps. For background on a long-running FFmpeg channel and its failure modes, see the 24/7 synthwave channel workflow.

Handle interruptions and protect the key

An FFmpeg process can stop because of an input error, a network interruption, a VM restart, an exhausted filesystem or an administrative action. Decide how you will notice a stopped process and how it should be restarted. A service manager or supervisor can restart a process after failure, but a restart does not necessarily resume at the correct playlist position or prevent a brief interruption on YouTube. Test the behaviour deliberately with non-public content before relying on it overnight.

Keep logs useful but safe. Capture enough information to diagnose missing files, encoder errors or failed connections, while ensuring the stream key is not copied into logs or support messages. Check disk space if you are also recording locally, and make the manifest and media paths stable across reboots. Document how to stop the process cleanly, update the playlist and rotate the stream key if needed.

The operating model is part of the choice. With a self-managed VM, you choose and maintain the system and can customise the process, but you also own monitoring, recovery and security. If managing a Linux process overnight is the pain point, StreamNeo removes that specific task by taking an uploaded file and running it as a YouTube live stream without requiring your computer to remain on. It is YouTube-only, so it is not a substitute if you need to control a custom FFmpeg workflow on your VM.

Before committing, compare the operating options on the pricing page. When the file and channel are ready, start free — 24-hour trial, no card.

FAQ

How do I loop a playlist with FFmpeg?

The concat demuxer reads manifest entries sequentially, but the example manifest reaches its end and does not by itself establish an endless loop. Plan how FFmpeg should restart or repeat the inputs, and test end-of-list behaviour before a continuous broadcast; the right approach depends on the playlist and whether transitions must be seamless.

How do I get the YouTube RTMP stream key?

Open the stream in YouTube Live Control Room and reveal or copy the current key and ingest URL shown there. Choose RTMPS when available, and protect the key as a secret rather than placing it in a public script or screenshot.

Can FFmpeg stream to YouTube from a VPS?

Yes, provided the machine can read the media, the FFmpeg build supports the needed codecs and protocol, and its outbound connection can sustain the selected stream. An Azure VM is one VPS-style environment, but the precise network capacity and encoding performance depend on its configuration and should be tested.

What bitrate and keyframe interval should I use?

Use YouTube's current table for your resolution and frame rate. Its guidance recommends a two-second keyframe frequency and says not to exceed four seconds; its H.264 1080p30 table entry recommends 5 Mbps with 4 Mbps as the minimum. These are guidance for that output case, not a universal setting for every source or connection.

YOU’VE REACHED THE END

Keep the ideas coming.

More guides, useful tools and a little help for your next broadcast.

Back to the journal ↗
YOUR NEXT READ

A little more to explore.

More Setup Guides guides ↗ · All topics ↗