To stream a still image with music to YouTube using FFmpeg, loop the image and audio inputs, encode them in a format YouTube accepts, and send the feed to the RTMPS address and stream key for a stream you created in YouTube Studio. The command below is a starting point, not a universal recipe: check your FFmpeg build, input files, channel configuration and live preview before relying on it.
A looping command can keep generating media, but it cannot by itself promise an uninterrupted 24/7 broadcast. You still need to arrange the YouTube broadcast, protect the stream key, monitor stream health and decide how to recover if FFmpeg, the network or the computer stops.
What this setup does
FFmpeg reads a still image as a repeating video source and reads music at real-time speed. It encodes those inputs into one outgoing live feed. The image stays on screen while the audio plays; if you provide a single track and loop it, the same track repeats. A playlist of tracks requires a different input arrangement, which should also be tested before a long run.
There are two distinct parts on YouTube. The incoming feed is the stream sent by the encoder, while the broadcast is the viewer-facing live event. YouTube’s Live API documentation describes them as separate resources and includes a 24/7 feed use case. That distinction matters if you intend to keep an encoder feed running while creating or managing separate broadcasts. See YouTube’s explanation of broadcasts and streams for how the concepts fit together.
The command is suited to an operator who can use a terminal and has already prepared a file-based programme. It does not create your YouTube live event, obtain credentials, check music rights, restart a failed process or confirm that viewers can hear the result. If you prefer a graphical encoder, the trade-offs are different; this guide to alternatives to OBS for an always-on podcast stream can help you think through that choice.
Check channel eligibility and Live Control Room
Before working on the command, confirm that your channel can use live streaming and complete any requirements YouTube presents. Requirements and channel status can change, so check the current guidance in YouTube Studio and the official YouTube live streaming tips. FFmpeg does not bypass eligibility, account verification or any other YouTube setup requirement.
In YouTube Studio, create or schedule an encoder-based live stream in Live Control Room. The interface supplies the ingest address and stream key for that stream. Use the values shown there, rather than guessing a generic endpoint. YouTube’s LiveStreams API resource calls these the ingestion address and stream name; encoders may ask for them in separate fields or as a combined destination.
Treat the key like a password. Do not put a working key in a public post, screenshot, shared terminal history or log that other people can read. A key copied into a shell command can remain visible in command history, depending on how you run it. If it is exposed, use YouTube Studio to reset it and update the command before reconnecting. YouTube explains key management in Manage live stream settings.
Plan a private or unlisted test before you announce the channel. Start the encoder, inspect the Live Control Room preview, and confirm the broadcast state you intend to use. Sending an encoder feed does not necessarily mean the public-facing broadcast has started; follow the controls and status shown for your stream.
Prepare the image and music inputs
Put the image and audio files somewhere FFmpeg can read them, and check that their paths are correct. Open each file independently before starting a long stream. A corrupt or unsupported image may prevent video from being produced, and a music file with no usable audio can leave a technically connected stream silent.
The sample uses image.jpg and music.mp3 as placeholder names. Replace them with your actual paths, quoting paths that contain spaces. Verify the installed FFmpeg build with ffmpeg -version and consult its help or documentation if an option is unavailable. FFmpeg’s documentation describes real-time input pacing and stream looping, but option behaviour can depend on build and input format.
The command does not specify an output size filter. In this example, the image’s dimensions determine the video dimensions, so a small square image will not automatically become a standard widescreen output. Decide whether you need to resize or pad the image, and check the resulting frame in a local test. Scaling can alter sharpness or crop composition; padding can preserve the full image but add borders. Choose deliberately instead of assuming that an encoder setting will reshape the source.
Use media that you are authorised to stream. Having an audio file on your computer does not establish that you have the rights needed for a public, continuous YouTube broadcast. The same applies to artwork, photographs and other visual material. YouTube’s general technical guidance cannot determine whether a particular track or image is cleared for your use, so check the relevant rights and the platform’s current rules before publishing.
Configure the still image and looping audio
Here is a representative starting point. It is an editorial example, not a tested result or a claim that the exact syntax works on every FFmpeg version and input combination:
ffmpeg -re -loop 1 -framerate 30 -i image.jpg \
-re -stream_loop -1 -i music.mp3 \
-c:v libx264 -tune stillimage -pix_fmt yuv420p -r 30 -g 60 \
-b:v 2.5M -maxrate 2.5M -bufsize 5M \
-c:a aac -b:a 128k -ar 44100 \
-f flv 'RTMPS_INGEST_URL/STREAM_KEY'
The first input uses looping and a frame rate so FFmpeg can keep producing video frames from one image. The second uses -stream_loop -1 to request that the audio input repeat indefinitely. The -re options pace file input at real-time speed rather than letting FFmpeg send the contents as quickly as it can process them. The FFmpeg documentation describes -re as equivalent to a real-time read rate and identifies it as useful for streaming files.
The -tune stillimage option is an encoder tuning choice for content with little or no movement. It is not a substitute for selecting sensible output dimensions and bitrate. The audio options ask for AAC encoding, a stated bitrate and a 44.1 kHz sample rate. YouTube lists AAC or MP3 audio among its accepted encoder options and recommends a 44.1 kHz sample rate for stereo audio; consult the current encoder settings for the configuration you plan to use.
If your programme consists of several tracks, do not assume that repeating one MP3 automatically produces a gapless playlist. Track boundaries, silence and file compatibility affect what the audience hears. Test the actual sequence, listen across transitions and decide how you will handle a track that is shorter, longer or damaged. For a music channel, a useful YouTube Live settings guide for a 24/7 music playlist may help with broader audio and stream decisions, but it does not replace testing your own files.
Set encoding and ingest destination
The sample uses H.264 video and AAC audio in an FLV output container, with an RTMPS destination represented by placeholders. Replace RTMPS_INGEST_URL and STREAM_KEY with the actual values YouTube gives you for the stream. Do not publish the completed command with a live key embedded. YouTube recommends RTMPS, an encrypted form of RTMP, and explains the process in its RTMPS ingestion guide.
The sample sets the frame rate to 30 and uses -g 60, which corresponds to a nominal two-second group of pictures at that frame rate. YouTube recommends a two-second keyframe interval and says it should not exceed four seconds. If you change the frame rate, revisit the GOP value instead of copying -g 60 unchanged. The right resolution and bitrate also depend on the image and the upload connection.
The example’s video bitrate is 2.5 Mbps. YouTube lists recommended ranges of 2–6 Mbps for 720p at 30 fps and 0.3–3 Mbps for 480p at 30 fps; these are recommendations, not guarantees of quality or reach. The sample does not ensure that the output is 720p, because it does not include scaling. Choose a deliberate resolution, compare it with YouTube’s current settings guidance and make sure your upload connection can sustain the resulting rate, allowing room for network variation.
If the connection is unstable, lowering the output demand may help, but it can also reduce picture quality. A static image has little motion, yet viewers still need a legible image and clean audio. YouTube recommends a speed test and a test stream; check the live preview and health status rather than treating the configured bitrate as proof that the stream is healthy. For a different approach to persistent hosting, this comparison of VPS costs for a 24/7 YouTube music stream can help frame the operating trade-off without changing YouTube’s encoding requirements.
Start the stream and monitor health
Begin with the test, not with a public launch. Run FFmpeg, watch its output for errors, and confirm that YouTube receives the feed. Check the image, listen to the preview, and review the Live Control Room health messages. Only proceed when the stream is behaving as intended and the broadcast controls show the state you want.
A long-running process is not the same thing as a monitored channel. FFmpeg can exit, the host computer can sleep or lose power, a network route can fail, or an input can stop producing usable media. YouTube recommends testing and monitoring; its stream health status documentation describes issues such as low bitrate, GOP length, unsupported audio and missing or inconsistent streams.
For unattended operation, decide who or what will notice a failure and what happens next. A process supervisor can restart a crashed process, while logging and alerts can help someone see that it restarted repeatedly or failed to reconnect. These are operational measures, not an uptime guarantee. You must also account for power and network resilience at the place running FFmpeg.
If you want to avoid keeping your own computer on for this particular file-based use case, StreamNeo can remove that computer-running burden: you upload a video, provide the YouTube stream key and the stream runs from the cloud with monitoring and automatic restarts if it drops. It is YouTube-only, and it does not remove the need to set up your channel and broadcast correctly or to choose media you are authorised to use.
A simple check should cover both the encoder and the viewer-facing broadcast. This guide to checking whether a 24/7 YouTube stream is still sending video from a VPS is relevant if you host the process yourself; an FFmpeg process that appears alive is not enough if the outgoing feed has stopped reaching YouTube.
Troubleshoot playback and connection issues
When the preview is black, start with the input and output rather than changing several options at once. Confirm the image path, that FFmpeg can decode it, and that the command is generating frames. If the image is unexpectedly small, stretched or cropped, inspect its dimensions and your scaling or padding choices. The sample has no scale filter, so it leaves the source dimensions in control.
If video arrives but there is no sound, check that the audio file opens, contains audible material and is being read by the command. Confirm that the intended audio stream is mapped and encoded. Listen to the preview at a useful volume, and check for silence at the beginning of a track or at a loop boundary. If your audience hears clipping, the guide to preventing clipping on a 24/7 YouTube radio stream covers a related problem; lowering the source level may be more useful than simply changing the streaming bitrate.
If YouTube reports a connection or stream-health problem, check the destination values carefully, then verify that the stream key belongs to the intended stream and has not been reset. Review FFmpeg’s output for authentication, protocol or encoder errors. Keep the actual key private while troubleshooting: redact it before sharing logs or screenshots, and reset it if it has been exposed.
For a feed that connects but drops repeatedly, separate local process failures from network failures. Check whether FFmpeg is exiting, whether the host remains awake, and whether the upload connection is steady. FFmpeg documentation includes examples of recovery mechanisms for some output cases, but a recovery option is not a promise of uninterrupted service and may not suit every build or RTMPS configuration. Test the precise configuration you intend to use.
Keep a record of the command that worked, the FFmpeg version, source file details and any relevant YouTube health messages, but never retain a live key in a shared log. If you change frame rate, dimensions, audio input or bitrate, retest the resulting feed. A known-good test gives you a clearer baseline than making several changes after a failure.
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
Does the command guarantee a continuous 24/7 stream?
No. It loops the inputs and paces file reading, but FFmpeg, the computer, the connection or YouTube’s ingest can still fail. Monitor the feed and plan how you will notice and respond to interruptions.
Will the command output 720p?
Not as written. It does not include a scaling filter, so the image dimensions determine the output dimensions. Choose and test a size that suits your artwork and upload connection.
Can I use any music file in a public live stream?
A file playing locally does not prove that you have permission to stream it publicly or continuously. Check the rights for both the music and image and follow YouTube’s current rules; the command cannot establish those rights for you.
What should I do if YouTube shows a stream-health warning?
Read the warning in Live Control Room and compare it with FFmpeg’s output, your configured settings and the actual preview. Correct one likely cause at a time, then run another test before relying on the stream.