How to create silent .ogg audio file

Silent audio

That's an outdated method. You can now use the anullsrc filter instead, and it will work on any OS:

ffmpeg -f lavfi -i anullsrc -t 5 -c:a libvorbis output.ogg
  • Default sample rate is 44100, and default channel layout is stereo. If you want something different you can do something like: anullsrc=r=48000:cl=mono (or use cl=1 for mono).

  • For Vorbis in general, avoid the native encoder vorbis if possible; libvorbis will provide a better output (although it doesn't really matter with a silent output).


Other somewhat related examples

Test tone

An annoying tone or beeping tone can be made with sine filter. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:

ffmpeg -f lavfi -i sine=f=220:b=4:d=5 -c:a libvorbis output.oga

Just black video

Using the color filter.

ffmpeg -f lavfi -i color=d=5 -c:v libtheora output.ogv
  • Default frame rate is 25 and default video size is 320x240. To change it: color=r=24:s=1280x720:d=5.

  • But who uses Theora anymore? A more modern alternative that likely fills its niche is VP8/VP9 + Vorbis in WebM: -c:v libvpx output.webm.

Test pattern + 440 Hz tone

Using testsrc and sine filters:

ffmpeg -f lavfi -i testsrc -f lavfi -i sine -t 10 -c:v libtheora -c:a libvorbis \
-q:v 5 -q:a 5 output.ogv
  • Change frame rate and video size the same way as shown above for the color filter.

  • See FFmpeg Filter Documentation: Video Sources for a list of many other video source filters such as smptehdbars.

Also see

  • FFmpeg Wiki: A Brief Theora and Vorbis Encoding Guide
  • FFmpeg Codecs Documentation: libtheora
  • FFmpeg Codecs Documentation: libvorbis
  • ​Hydrogen Audio: Recommended Vorbis Encoder Settings
  • FFmpeg Wiki: VP8 Video in WebM Encoding Guide

Specify -acodec to be vorbis (instead of libmp3lame) and put .ogg at the end of the output file (in place of .mp3).

Tags:

Audio

Ffmpeg

Ogg