For a YouTube sleep stream, FFmpeg’s loudnorm filter can help keep the programme’s overall loudness and peaks within chosen bounds. Use single-pass processing for a live feed; for a finished file, measure it first and then apply the measurements in a second pass when the filter can use linear mode.
The values I=-18:LRA=7:TP=-2 are a restrained editorial starting point for subdued material, not a YouTube requirement. They do not guarantee a particular listening level or a natural result: listen to the rendered audio and the uploaded playback, especially through quiet passages and transitions.
What loudness normalisation can do
FFmpeg’s loudnorm filter implements EBU R128 loudness normalisation. Its main controls describe different things: I sets a target for integrated loudness, usually expressed in LUFS; LRA sets a target loudness range in LU; and TP sets a maximum true-peak target in dBTP. Integrated loudness is a measure of the programme over time, loudness range describes variation, and true peak helps leave headroom for peaks that can exceed sample peaks during conversion or playback.
These controls are not three ways of asking for the same result. Setting an integrated-loudness target does not make every moment equally loud, while a true-peak limit does not itself make a quiet rain recording audible enough. A fan hum, distant thunder or music swell can remain different from one another even after processing. That difference is often part of the soundscape rather than a problem to erase.
loudnorm can operate in single-pass mode, including on a live stream. It can also use a two-pass workflow on a completed file: measure the source, then supply the measurement results when processing it. The FFmpeg loudnorm filter documentation explains the filter’s modes and its measurement fields. Its defaults are filter defaults, not instructions for YouTube uploads.
Normalisation cannot repair every source issue. A recording with a sudden edit, a click, a loud bird call or a noisy recording floor may still sound distracting after its average level is adjusted. Likewise, if stereo ambience loses important texture when folded down to mono, a loudness filter will not fix that. Treat normalisation as one step in preparing and checking the audio, not as a substitute for a clean source or a listening test.
Choose live single-pass or file two-pass processing
The practical choice is about whether you have a running programme or a finished file to analyse. Single pass keeps the workflow in the live pipeline and reacts dynamically as audio changes. Two pass takes longer because it scans the file and then renders it, but gives you measurements from the complete source and can use linear gain if the requested targets are compatible.
| Workflow | Best fit | What happens | Main trade-off |
|---|---|---|---|
| Single pass | Continuous live audio or a quick conversion | The filter works as audio arrives and adjusts dynamically | Gain behaviour can change with the programme; listen for movement during transitions |
| Two pass | A completed recording you can inspect before streaming | A measurement pass is followed by a render pass using the reported values | Takes an extra pass and linear mode is not always possible |
This is not a quality ranking. A single-pass filter is useful when there is no complete source to measure, as with a continuous live feed. A two-pass workflow is more reproducible for a known, finished recording, but it is not automatically more pleasant to listen to. If FFmpeg cannot meet the chosen constraints with linear gain, it can fall back to dynamic processing.
For a file that will be looped, inspect the loop boundary as well as the loudest and quietest sections. A seam between the end and beginning can reveal a level jump that a whole-file loudness measurement does not make musically smooth. If the channel uses several recordings in rotation, each file may need its own review rather than assuming one set of measurements suits them all. For broader planning around recorded material, see the guide to building a continuous stream from a video library.
Measure the completed source
For two-pass processing, measure the exact completed file you intend to render. The measurement pass does not need to produce an output video; it reads the source and prints values for the chosen loudnorm targets. Here is an example using the suggested editorial starting point:
ffmpeg -i input.mp4 -af "loudnorm=I=-18:LRA=7:TP=-2:print_format=json" -f null -
The command sends the audio through loudnorm and discards the output with -f null -. Read the JSON summary and record input_i, input_lra, input_tp, input_thresh and target_offset. They describe the measured input and the offset reported for the requested target. Keep the values together with the target settings and the name of the file; using results from a different source or a changed edit defeats the point of measuring the completed material.
A measurement is information, not a verdict about whether the sound is comfortable. For example, the overall integrated loudness can be within a chosen target while an isolated chime still feels too prominent at bedtime. The filter’s measurements also do not decide whether a particular low-frequency drone is soothing on headphones or tiring on a phone speaker. Note any sections that sound unusually prominent as you review the file, and decide whether they need a source edit or a gentler processing choice.
The I, LRA and TP values in the example are deliberate choices for illustration, not a universal preset. If the material is a quiet natural recording, a more restrained target may suit it than a track with broad musical dynamics; the right choice depends on source level, intended listening context and how much variation you want to preserve. Avoid choosing a more aggressive target simply because you want the stream to sound louder than other content.
Apply the measurements in a second pass
Use the values reported by the first pass in the measured fields of the second-pass command. The placeholders below are explanatory only; replace every uppercase placeholder with its numeric result from the measurement output before running the command.
ffmpeg -i input.mp4 -af "loudnorm=I=-18:LRA=7:TP=-2:measured_I=INPUT_I:measured_LRA=INPUT_LRA:measured_TP=INPUT_TP:measured_thresh=INPUT_THRESH:offset=OFFSET:linear=true:print_format=summary" -c:v copy -c:a aac -b:a 192k -ar 48000 output.mp4
The measured labels are measured_I, measured_LRA, measured_TP, measured_thresh and offset; do not paste the input labels from the JSON output in their place. In particular, the measurement called target_offset supplies the value for the second pass’s offset field. Preserve the rest of the command’s target settings if those are the targets you measured against.
The request linear=true asks the filter to use linear gain where possible. Check the final summary to see which mode FFmpeg actually selected. Linear mode requires all four measured inputs, and FFmpeg may revert to dynamic mode if the requested loudness range is below the measured source range or if the target true-peak constraint cannot be met with the required gain. If that happens, do not assume the command failed silently or that the output is necessarily unusable: inspect the summary, listen, and reconsider whether the targets fit the source.
The example copies video with -c:v copy and encodes audio as AAC. You can change container and codec options for a WAV master or another delivery format, but confirm that the resulting file is suitable for your upload workflow. YouTube’s recommended upload encoding settings include AAC-LC audio at 128–256 kbps and a 44.1 or 48 kHz sample rate. Those are audio delivery recommendations, not loudness targets. The example’s -ar 48000 makes the output sample rate explicit; FFmpeg’s filter can internally upsample for true-peak detection in dynamic mode, which is separate from the output sample rate.
Use a restrained starting point for sleep audio
For a subdued ambience programme, I=-18:LRA=7:TP=-2 is a practical point from which to listen and adjust. It is not a platform rule, and it does not promise that viewers will hear the same level on every device. Integrated loudness describes the overall programme; the actual perceived level depends on source characteristics, playback volume, speaker or headphones, and the surrounding environment.
The range target matters for sleep audio because the goal is not necessarily to flatten every variation. A rain bed may contain gentle changes that help it sound like rain rather than a fixed noise. A low LRA target can constrain those changes, but it does not know which changes are musically or atmospherically important. If the target range is incompatible with the source, the filter may use dynamic processing rather than the linear mode requested in a two-pass command.
The true-peak target is another guardrail, not a loudness setting. It can help prevent peaks from exceeding the chosen ceiling, but lowering a peak target does not make the background bed fuller. Use headroom thoughtfully, especially when encoding or combining audio, and listen for transient sounds that draw attention even when the peak reading is acceptable.
You may see FFmpeg’s default integrated target of -24 LUFS and mistake it for the right target for every stream. It is the filter’s default, not YouTube’s upload requirement. The official YouTube pages cited here do not publish a universal integrated-loudness or true-peak target for creators. In the same way, a commonly repeated figure should not be presented as an official sleep-stream setting without an official source that says so.
If you want to keep a stream running while your own computer is off, StreamNeo removes the recurring task of keeping the local FFmpeg session open and recovering it after a drop; it takes an uploaded video and runs it as a YouTube live stream. That is a continuity choice, not an audio mastering step, so prepare and audition the sound file before you upload it.
Listen for ambience and abrupt level changes
Listen to the rendered file at a sensible playback level before relying on it for an overnight stream. Include the quietest passage, the loudest passage and transitions between them. For a loop, listen across the join. A normalised average can conceal a raised bird call, a wind gust, a music entry or a gap that feels startling after a long quiet section.
Pay attention to gain movement. With single-pass dynamic processing, listen for pumping or audible shifts as the scene changes. Quiet sections can also become more exposed, bringing up room noise, hiss or details you did not intend to foreground. If that happens, reconsider the target or edit the source rather than simply increasing the processing. A sleep stream can be consistent without every component being pushed towards the same prominence.
After rendering, run a measurement on the output as a check and read the summary for output loudness, true peak and mode. Then listen again; figures can tell you whether the output landed near the selected target, but they cannot decide if the atmosphere still feels natural to you. Check mono compatibility as well as stereo. YouTube’s upload guidance warns that stereo material that folds down poorly can lose quality or be muted on devices that convert stereo to mono, so verify that rain, drone or music remains coherent when channels are combined.
Finally, inspect the uploaded playback rather than judging only the local file. YouTube says its player has a Stable volume option where available, and that it may apply audio enhancements. Viewer settings and devices can affect the result, so a creator-side setting cannot guarantee identical perceived dynamics for every listener. If playback seems unexpectedly different, YouTube’s Stats for Nerds troubleshooting guide can help you examine playback diagnostics; it is not evidence of a universal loudness target.
For the rest of the broadcast workflow, a guide on checking YouTube’s ingest URL from an Indian data centre is relevant when you are diagnosing connection setup separately from sound quality. If your stream is based on recorded lessons rather than ambience, the notes on running a 24/7 stream from recorded lectures cover a different source workflow; the same principle applies here: test the actual material, not an abstract preset.
A practical hand-off checklist is short: keep the measurement output, confirm the mode in the render summary, audition quiet and loud sections, check the loop seam, verify mono playback, and inspect the uploaded stream with the player controls you expect viewers to use. If any check reveals a distracting change, revise the source or settings and repeat the render. A successful command is not the same as a successful listening result.
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
Should I use loudnorm or dynaudnorm for rain or sleep music?
This workflow uses loudnorm, which is designed for EBU R128 loudness normalisation and provides integrated loudness, range and true-peak targets. A different filter may suit a different production aim, but do not assume it will preserve ambience better without listening to the result. Compare representative quiet passages and transitions before settling on a method.
What LUFS should a YouTube sleep stream be?
YouTube’s official guidance cited above gives audio encoding recommendations, not a universal integrated-loudness target. I=-18 can be a restrained editorial starting point for subdued material, but it is not a YouTube requirement or a guarantee of a preferred listening level. Choose based on the source and playback context, then listen to the upload.
Can I use two-pass loudnorm on a live stream?
Two-pass processing needs measurements from the complete source, so it is suited to a file that already exists rather than an open-ended live programme. For live audio, use single pass and review how it behaves through quiet and loud changes. If you can prepare a finished file in advance, measure and render that file before streaming.
Why did FFmpeg not use linear mode?
The second pass needs all the measured values, and the requested range and true-peak constraints must be compatible with the source. If they are not, FFmpeg can fall back to dynamic mode even when the command requested linear=true. Check the summary, then decide whether different targets or a dynamic result are appropriate for the material.