A track missing from an FFmpeg music stream can be lost in the local playlist, at a file boundary, or only after FFmpeg sends the output to YouTube. First find which of those is happening; changing bitrate or adding a restart policy will not fix a bad file list or incompatible media.
Work from a short test containing the last track that plays and the first one that appears to be skipped. Check that sequence locally, then inspect FFmpeg’s inputs, mappings and log, and finally compare the result with YouTube Studio’s preview and stream-health messages. Keep those three layers distinct: playlist playback, live encoding and ingest, and process supervision.
Check live-stream eligibility before troubleshooting
Before you build a persistent broadcast, confirm that the YouTube channel can go live. Sign in to the channel you intend to use, open YouTube Studio and follow its current live-streaming setup prompts. YouTube may require channel verification or other eligibility steps, and enabling live streaming can take time to become available. Check the current YouTube Help instructions for enabling live streaming rather than assuming a newly enabled channel is ready immediately.
This check does not explain a skipped local file, but it prevents a second problem from being mistaken for the first. If Studio does not allow the channel to start a broadcast, fix that account or channel state before debugging a connection that has not yet reached a valid live session.
For diagnosis, collect the FFmpeg version, the playlist text with private paths removed, the exact command with credentials redacted, and the log lines around the transition. Also note whether the affected track plays when you test the local sequence. Avoid pasting a stream key into a support forum, issue tracker or article comment. A log can contain URLs or other identifying details, so review it before sharing.
Create a YouTube Live stream in Studio
In YouTube Studio, create or open the live stream you intend to use and locate its stream settings. Studio provides the destination and stream key used by the encoder, along with a preview and information about the incoming signal. Treat the key as a password, and use the current instructions in YouTube Help for setting up a live stream with an encoder.
The Studio setup and the FFmpeg playlist are separate. A correctly configured stream in Studio cannot repair a missing file in a concat list. Conversely, a playlist that plays correctly on your machine does not establish that YouTube is receiving a compatible, healthy live signal. Keep the Studio page open during a controlled test so you can compare what FFmpeg reports with what YouTube shows.
If the channel is already live, avoid changing several variables at once. For example, test a two-file excerpt using the same output settings rather than replacing the playlist, encoder parameters and stream key together. If the preview remains blank or reports a problem, preserve the relevant timestamps and messages for the ingest investigation; do not infer that the local file was skipped from a preview issue alone.
Prepare the FFmpeg playlist and media
The FFmpeg concat demuxer reads a text script of files and directives sequentially as one virtual input. Its files need compatible stream layouts, including codecs and time bases. The demuxer uses each file’s duration to place the next file’s timestamps, so inaccurate duration metadata can create a bad transition even when every path in the list is correct. See the FFmpeg concat demuxer documentation.
Start with the playlist itself. Confirm that each intended track appears once, in the intended order, with its spelling and path correct. Check the directory relative to which FFmpeg resolves paths, and whether a playlist-generation script is omitting, duplicating or sorting files unexpectedly. The concat script has its own format; it is not just any list of filenames. A path with spaces, quoting or unusual characters can behave differently from a simple test path, so validate the actual list with a small excerpt.
Some operators use -safe 0 when a playlist contains paths rejected by FFmpeg’s default safety checks. Only use it with a playlist you control and have inspected. It relaxes path restrictions; it does not make untrusted playlist contents safe. If the playlist is generated, make sure that process cannot add arbitrary paths.
Then compare the last known-good track with the first apparently skipped one. Inspect their streams, codecs, time bases, durations and whether both files can be read to the end. A file may have an unusual or estimated duration, broken metadata, or be truncated. If the next file’s timestamp is positioned using a wrong duration, the boundary can look like a skipped or clipped track. Use an explicit duration directive only when you have verified the correct duration; guessing can move the error elsewhere.
Do not assume -c copy makes unlike files compatible. Stream copy avoids re-encoding, but it does not normalise different stream layouts. If all files have compatible streams and the output is otherwise correct, copy may be suitable. If the clips need to be made consistent, FFmpeg’s FAQ describes the concat filter for concatenation that requires re-encoding. That takes more processing and may change the output, but lets you create a common format rather than hoping incompatible inputs will join cleanly.
| Finding in the test | Next check | Practical trade-off |
|---|---|---|
| The local excerpt skips a file | List order, paths, file readability and concat syntax | Correcting the source list is simpler than changing the encoder, but does not address an independent output fault |
| The tracks play locally, but one input has a different stream layout | Compare codecs, time bases and stream details; test the concat filter if needed | Re-encoding can make inputs consistent, at the cost of processing and another encoding step |
| The file boundary is wrong despite correct order | Verify duration metadata and truncation; override duration only with a known value | A precise override can correct timestamp placement; an estimate can introduce another boundary error |
| The expected audio is absent from the output | Inspect input streams and output mapping | Explicit mapping clarifies selection, but cannot create audio that is missing or unreadable at input |
| Local output is sound, but YouTube preview is not | Read FFmpeg output errors and check Studio’s stream health | This points to output or ingest diagnosis, not a playlist rewrite |
If automatic stream selection is choosing the wrong audio or video stream, use explicit -map options after inspecting the inputs. FFmpeg selects streams according to its rules when you do not specify mapping; a file with multiple streams can therefore produce a different output than expected. The FFmpeg CLI documentation on stream selection and -map explains how to control that. Confirm that the resulting output contains the intended audio before blaming YouTube for silence.
A practical diagnostic is to play the short excerpt locally with the same input sequence and inspect the FFmpeg log at its transition. Record whether a file failed to open, timestamp processing reported an issue, a stream was excluded, or the output connection failed. The purpose is not to treat a particular message as a universal diagnosis, but to determine which layer needs attention. For a broader example of a playlist-based FFmpeg setup, see running an FFmpeg YouTube playlist stream on a Raspberry Pi 4; the same input checks matter even if your machine differs.
Set output settings for YouTube
Once the local sequence is correct, confirm that the outgoing encoder settings are compatible with YouTube’s current requirements. YouTube’s live encoder guidance lists RTMP and RTMPS, recommends RTMPS, and covers supported video and audio codecs, bitrate modes, keyframes and audio settings. Its video bitrate recommendations vary by codec, resolution and frame rate, so use the current YouTube live encoder settings for the format you are actually sending rather than copying one generic bitrate into every command.
For example, YouTube recommends a two-second keyframe interval and says not to exceed four seconds. For stereo, its advanced settings list 44.1 kHz and 128 Kbps audio as recommended; 5.1 uses different recommendations. These are YouTube’s published settings, not a guarantee that a stream will be accepted or uninterrupted. Match the settings to your media and encoder, then confirm what Studio reports during a test.
For a real-time music stream, the input needs to advance at a real-time pace rather than being sent as fast as the computer can read it. Operators commonly use input pacing and a loop option for a repeating playlist, but the right command depends on your FFmpeg build, media layout, output format and destination URL format. Do not lift a command that contains a real key or assumes your files’ codecs. Test the command with a short sequence and retain its output log.
FFmpeg’s FIFO muxer has controls such as attempt_recovery and recovery_wait_time for some network-output failures. Those controls address output continuity, not a missing filename, wrong duration or incompatible local input. The documentation also notes that dropping packets on overflow permits processing to continue while omitting part of the stream. Recovery settings can therefore have trade-offs; they are not a substitute for correcting the playlist or checking YouTube ingest.
Protect the stream key
A stream key authorises a broadcast to the associated YouTube stream. Keep it out of public scripts, screenshots, shell history, shared logs, source-control repositories and support requests. If you accidentally disclose it, use Studio’s current key-management controls to reset or replace it, then update the encoder configuration that uses it.
For a systemd service, place credentials in a file readable only by the account and service that need them, or use an appropriate systemd credential mechanism for your system. Avoid putting the key directly in a unit file that other users can read, or in a command line that may be recorded in process listings or logs. The exact secure method depends on your operating system and permissions; check your distribution’s systemd documentation and test access as the service user.
Separate the destination address from the secret wherever the encoder and service design permits. When asking for help, redact the key and any URL component that embeds it, along with private file paths if necessary. A log is useful evidence only if sharing it does not create another operational problem.
This matters especially after a reboot. A service that starts automatically still needs to read the right credential and reach the intended Studio stream. Confirm the configuration without printing secrets to the terminal, and never add a real key to a diagnostic command copied into a public discussion.
Configure a systemd service carefully
Systemd can supervise an FFmpeg process and start it under defined conditions. It does not create or configure the YouTube Live stream, make incompatible media compatible, or guarantee that a dropped output will recover. Make those boundaries explicit when you design the service: fix the input and output first, then use process supervision to manage the program’s lifecycle.
Create a dedicated service account with access only to the media, playlist, configuration and log destinations it needs. Keep the playlist and media at stable paths rather than relying on a shell’s current working directory. A unit can specify a working directory and the command to run; use the absolute path to FFmpeg and verify that the service account can read each input file and credential. A command that works in your interactive shell may fail as a service because its environment, permissions and path resolution differ.
Use a unit file that describes the actual command and its dependencies, and choose restart behaviour deliberately. A restart policy can start a process again after it exits, but it cannot tell whether the previous exit came from a bad playlist, a revoked key, a missing file, a network fault or an intentional stop. Blind restarts may repeatedly replay the same failure. Start with a policy that fits your maintenance method, and pair it with logs and a way to stop the service while investigating.
Keep the FFmpeg command in a controlled configuration rather than making the unit difficult to review. If a playlist changes, test the revised list separately before asking systemd to run it continuously. For changes that need to be made while a broadcast remains active, the operational choices differ; see how to schedule a playlist change without ending a YouTube livestream. A playlist edit is not proof the running FFmpeg process has loaded that edit.
After creating or changing a unit, reload systemd’s unit definitions, start the service deliberately, and check its status and journal. Do not assume that enabling a service means it is currently running, or that a running process means YouTube is receiving a healthy stream. These are separate checks. If you use an FFmpeg reconnection or FIFO recovery option, understand what failures it handles and what data may be omitted before combining it with systemd restarts.
Check startup, logs and reboot behaviour
First test in stages. Run the short local playlist test. Then run the same controlled excerpt through FFmpeg to YouTube and inspect Studio. Only after those checks should you test the supervised service. This makes it easier to tell a bad input from a credential or permission failure and from an output connection issue.
For systemd, inspect service status and the journal around startup and the affected track transition. Look for failures opening a file, permission errors, timestamp warnings, output connection messages and process exits. Preserve enough context to see what happened before and after the transition, but redact secrets before sharing. Check that the service is running as the intended user and that the playlist paths resolve from its configured working directory.
A reboot test is an operations check, not a streaming guarantee. Before rebooting a machine that carries a live channel, choose a maintenance window or another safe time, and understand that the stream may stop while the host restarts. After it returns, verify that the service starts, the process can read its files and key, and Studio receives the encoder again. Systemd can initiate a process according to its unit; YouTube must still accept the incoming stream and the media must still be valid.
If FFmpeg exits repeatedly, stop treating restarts as the fix. Capture one complete failure sequence, resolve the underlying cause, then test again. If a new playlist is produced by a script at boot, make sure the script has completed successfully before FFmpeg reads it. A service may start correctly and still consume an incomplete or stale list.
For a channel running from a home connection, do not conflate host reboot behaviour with internet reliability. If local output logs are clean but Studio reports dropped frames or a weak connection, investigate the route and connection separately; diagnosing dropped frames on JioFiber covers that distinct layer. A network remedy will not restore a track that the local concat input never included.
Monitor YouTube stream health separately
During a test, keep YouTube Studio’s Live Control Room preview and health messages visible. Compare the audible and visible output there with the local excerpt and FFmpeg log. If the local sequence is correct but the preview loses audio, inspect mapping, output errors and the incoming signal before editing track order. If Studio shows a connection problem while the local playback remains fine, investigate encoder settings and network output as a separate fault.
YouTube recommends testing with representative audio and video, checking the preview and monitoring stream health. Use a test that resembles the real channel: same media types, output settings and playlist transitions. A short test with one simple file may not exercise the boundary where the problem occurs, so include the known transition but keep the test controlled.
FFmpeg output recovery features and YouTube ingest health answer different questions. Recovery controls may help the muxer continue after certain network errors; Studio shows whether YouTube is receiving a signal it can use. Neither confirms that all intended tracks are present. Keep a record of the playlist version, service restart time, FFmpeg version and Studio messages for each test so you can compare changes without relying on memory.
If maintaining the machine, key, service and playlist is the pain point rather than diagnosing a particular FFmpeg error, StreamNeo can take the uploaded-file-to-live-broadcast task off the computer you would otherwise need to keep running; it does not change the need to check YouTube’s channel setup and content rights. For a self-managed FFmpeg setup, continue to keep the list, encoder and service under separate checks.
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
Why did FFmpeg jump to the next song?
There is no single cause without the playlist and log. Check that the file is present in the concat script and opens correctly, then inspect the boundary files’ stream compatibility and duration metadata. Test the affected pair locally before changing output settings.
The local playlist plays correctly, but YouTube Live skips audio. What should I check?
Inspect FFmpeg’s output log, input stream listing and output mappings, and confirm that the encoded output contains the intended audio. Then compare the result with Studio’s preview and stream-health messages. A healthy local sequence narrows the search, but does not establish that YouTube is receiving the same output correctly.
Will systemd restart FFmpeg and keep the channel live?
Systemd can supervise a process and start it again under the unit’s configured conditions, but it does not guarantee recovery or uninterrupted playback. The restarted process still needs readable media and credentials, a valid FFmpeg command, a working connection and a stream YouTube accepts. Check the journal and Live Control Room after a restart.
Should I use stream copy or re-encode the playlist?
Use stream copy only when the inputs are compatible for the intended output; it does not normalise mismatched codecs or time bases. If the clips need a common format, test the concat filter and re-encoding on a short excerpt, accepting the extra processing and encoding step. Choose based on the inspected media, not on a universal command.