FFMPEGFS(1)

okay so this is the manual page for ffmpegfs โ€” you know, the FFMPEGFS(1) User Commands one ๐ŸŽ€ and bestie, it's a whole moment. Buckle up. โœจ


๐ŸŒธ NAME ๐ŸŒธ

ffmpegfs โ€” mounts and transcodes a multitude of formats to one of the target formats on the fly. ๐Ÿ’ซ


โœจ SYNOPSIS โœจ

ffmpegfs [OPTION]... IN_DIR OUT_DIR

๐Ÿ’– DESCRIPTION ๐Ÿ’–

okay so here's the vibe: the ffmpegfs(1) command mounts the directory IN_DIR on OUT_DIR. ๐Ÿช„

After that? Accessing OUT_DIR shows you the contents of IN_DIR, and all the supported media files get transparently renamed and transcoded to one of the supported target formats the moment you access them. no cap, it just does that. ๐Ÿ‘‘

๐Ÿฆ‹ Supported output formats ๐Ÿฆ‹

quick heads up before the list: where the original table had a blank cell, we're writing (none). Everything else is written exactly how it was. ๐Ÿซถ

  • AIFF โ€” Audio Interchange File Format ยท audio: (none) ยท video: PCM 16 bit BE
  • ALAC โ€” Apple Lossless Audio Codec ยท audio: (none) ยท video: ALAC
  • FLAC โ€” Free Lossless Audio ยท audio: (none) ยท video: FLAC
  • HLS โ€” HTTP Live Streaming ยท audio: H264 ยท video: AAC
  • MOV โ€” QuickTime File Format ยท audio: H264 ยท video: AAC
  • MP3 โ€” MPEG-2 Audio Layer III ยท audio: (none) ยท video: MP3
  • MP4 โ€” MPEG-4 ยท audio: H264 ยท video: AAC
  • OGG โ€” (no description) ยท audio: Theora ยท video: Vorbis
  • MKV โ€” Matroska ยท audio: H264 ยท video: AAC
  • Opus โ€” (no description) ยท audio: Opus ยท video: (none)
  • ProRes โ€” Apple ProRes ยท audio: ProRes ยท video: PCM 16 bit LE
  • TS โ€” MPEG Transport Stream ยท audio: H264 ยท video: AAC
  • WAV โ€” Waveform Audio File Format ยท audio: (none) ยท video: PCM 16 bit LE
  • WebM โ€” (no description) ยท audio: VP9 ยท video: Opus
  • BMP โ€” Video to frameset ยท audio: (none) ยท video: BMP
  • JPG โ€” Video to frameset ยท audio: (none) ยท video: JPEG
  • PNG โ€” Video to frameset ยท audio: (none) ยท video: PNG

๐Ÿ’… OPTIONS ๐Ÿ’…

Usage: ffmpegfs [OPTION]... IN_DIR OUT_DIR

Mount IN_DIR on OUT_DIR, converting audio and video files upon access. ๐ŸŽฌ

๐ŸŽ€ Encoding options ๐ŸŽ€

  • --desttype=TYPE, -odesttype=TYPE โ€” pick your destination format, bestie. TYPE can currently be:

AIFF, ALAC, BMP, FLAC, HLS, JPG, MOV, MP3, MP4, MKV, OGG, Opus, PNG, ProRes, TS, WAV, WebM.

  • To stream videos, MP4, TS, HLS, OGG, WEBM, MKV, or MOV/PRORES must be selected.
  • To use HTTP Live Streaming, set HLS.
  • When a destination JPG, PNG, or BMP is chosen, all frames of a video source file will be presented in a virtual directory named after the source file. Audio will not be available. ๐Ÿšซ๐ŸŽง
  • To use the smart transcoding feature, specify a video and audio file type, separated by a + sign. For example, --desttype=mov+aiff will convert video files to Apple Quicktime MOV and audio-only files to AIFF. โœจ
  • Defaults to: mp4
  • --audiocodec=TYPE, -oaudiocodec=TYPE โ€” select an audio codec. TYPE depends on the destination format and can currently be:
that's a table, so here it is as a list instead ๐Ÿ’–
  • MP4 โ†’ AAC, MP3
  • WebM โ†’ OPUS, VORBIS
  • MOV โ†’ AAC, AC3, MP3
  • MKV โ†’ AAC, AC3, MP3
  • TS, HLS โ†’ AAC, AC3, MP3

Other destination formats do not support other codecs than the default.

Defaults to: The destination format's default setting, as indicated by the first codec name in the list.

  • --videocodec=TYPE, -ovideocodec=TYPE โ€” select a video codec. TYPE depends on the destination format and can currently be:
    • MP4 โ†’ H264, H265, MPEG1, MPEG2
    • WebM โ†’ VP9, VP8, AV1
    • MOV โ†’ H264, H265, MPEG1, MPEG2
    • MKV โ†’ H264, H265, MPEG1, MPEG2
    • TS, HLS โ†’ H264, H265, MPEG1, MPEG2

Other destination formats do not support other codecs than the default.

Defaults to: The destination format's default setting, as indicated by the first codec name in the list.

  • --autocopy=OPTION, -oautocopy=OPTION โ€” okay bestie, this one is the big brain setting โœจ it picks your auto copy mode. OPTION can be:
    • OFF โ€” never copy streams, transcode always. no shortcuts, we're doing the work ๐Ÿ’…
    • MATCH โ€” copy the stream if the target supports the codec.
    • MATCHLIMIT โ€” same as MATCH, but only copy if the target isn't larger; transcode otherwise.
    • STRICT โ€” copy the stream if the codec matches the desired target, transcode otherwise.
    • STRICTLIMIT โ€” same as STRICT, but only copy if the target isn't larger; transcode otherwise.

This can speed up transcoding significantly because copying streams uses so much less computing power compared to transcoding. like it's not even close ๐Ÿ˜ญ

MATCH copies a stream if the target supports it, e.g., an AAC audio stream will be copied to MPEG, although FFmpeg's target format is MP3 for this container. H264 would be copied to ProRes, although the result would be a regular MOV or MP4, not a ProRes file. it's giving "close enough" energy ๐Ÿ™ˆ

STRICT would convert AAC to MP3 for MPEG or H264 to ProRes for Prores files, to strictly adhere to the output format setting. This will create homogenous results which might prevent problems with picky playback software. iconic behaviour honestly ๐Ÿ‘‘

Note: When the --audiocodec or --videocodec option is specified, the STRICT option should be used to ensure that the chosen output codec is used in any scenario. MATCH would enable copy if the output format supports the input codec.

Defaults to: OFF

  • --recodesame=OPTION, -orecodesame=OPTION โ€” picks the "recode to the same format" option. OPTION can be:
    • NO โ€” never recode to the same format.
    • YES โ€” always recode to the same format.

Defaults to: NO

  • --profile=NAME, -oprofile=NAME โ€” sets the profile for your target audience, bestie ๐ŸŽ€ NAME can be:
    • NONE โ€” no profile
    • FF โ€” optimise for Firefox
    • EDGE โ€” optimise for MS Edge and Internet Explorer > 11
    • IE โ€” optimise for MS Edge and Internet Explorer โ‡ 11
    • CHROME โ€” Google Chrome
    • SAFARI โ€” Apple Safari
    • OPERA โ€” Opera
    • MAXTHON โ€” Maxthon
Note: applies to the MP4 output format only, and is ignored for all other formats. the way that it just doesn't care about anything else ๐Ÿ’€

Defaults to: NONE

  • --level=NAME, -o level=NAME โ€” sets the level for the output if it's available. NAME can be:
    • PROXY โ€” Proxy โ€“ apco
    • LT โ€” LT โ€“ apcs
    • STANDARD โ€” standard โ€“ apcn
    • HQ โ€” HQ - apch
Note: applies to the MP4 output format only, and is ignored for all other formats. again, MP4 only, everyone else stay in your lane ๐Ÿฆ‹

Defaults to: HQ

  • --include_extensions=LIST, -oinclude_extensions=LIST โ€” sets the list of file extensions to be encoded ๐ŸŒธ LIST can have one or more entries separated by commas. These are the only file extensions that will be transcoded. Can be specified numerous times and the entries will be merged, which is required when specifying them in the fstab because commas cannot be used to separate the extensions. The entries support shell wildcard patterns. so basically: a curated guest list, and wildcards are on it โœจ

Example: --include_extensions=mp4,wmv to encode MPEG-4 and Windows Media files only.

Defaults to: Encode all supported files.

  • --hide_extensions=LIST, -ohide_extensions=LIST โ€” sets a list of file extensions to exclude from the output ๐Ÿ™ˆ LIST can have one or more entries separated by commas. Can be specified numerous times and will be merged, which is required when specifying them in the fstab because commas cannot be used to separate the extensions. The entries support shell wildcard patterns.

Example: --hide_extensions=jpg,png,cue to stop covers and cue sheets from showing up.

Defaults to: Show all files.


๐ŸŽง AUDIO OPTIONS ๐ŸŽง

  • --audiobitrate=BITRATE, -o audiobitrate=BITRATE โ€” selects the audio encoding bitrate ๐ŸŽต

Defaults to: 128 kbit

Acceptable values for BITRATE:

mp4: 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256, 288, 320, 352, 384, 416, and 448 kbps.

mp3: For sampling frequencies of 32, 44.1, and 48 kHz, BITRATE can be among 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, and 320 kbps.

For sampling frequencies of 16, 22.05, and 24 kHz, BITRATE can be among 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, and 160 kbps.

When in doubt, it is recommended to choose a bitrate among 96, 112, 128, 160, 192, 224, 256, and 320 kbps. like if you're stressed, just pick from that list, it's the safe zone ๐Ÿซถ

BITRATE can be defined as...

  • n bit/s: # or #bps
  • n kbit/s: #K or #Kbps
  • n Mbit/s: #M or #Mbps
  • --audiosamplerate=SAMPLERATE, -o audiosamplerate=SAMPLERATE โ€” this limits the output sample rate to SAMPLERATE. If the source file sample rate is higher, it will be downsampled automatically. no asking, it just does it ๐Ÿ’…

Typical values are 8000, 11025, 22050, 44100, 48000, 96000, and 192000.

If the target codec does not support the selected sample rate, the next matching rate will be chosen (e.g. if 24K is selected but only 22.05 or 44.1 KHz is supported, 22.05 KHz will be set). it finds a rate that actually works, we love a problem solver โœจ

Set to 0 to keep the source rate.

Defaults to: 44.1 kHz

SAMPLERATE can be defined as...

  • In Hz: # or #Hz
  • In kHz: #K or #KHz
  • --audiochannels=CHANNELS, -o audiochannels=CHANNELS โ€” this limits the number of output channels to CHANNELS. If the source has more channels, the number will be reduced to this limit.

Typical values are 1, 2 or 6 (e.g., 5.1) channels.

If the target codec does not support the selected number of channels, transcoding may fail. not a vibe, so double check your codec bestie ๐Ÿ˜ญ

Set to 0 to keep the number of channels.

Defaults to: 2 channels (stereo)

  • --audiosamplefmt=SAMPLEFMT, -o audiosamplefmt=SAMPLEFMT โ€” this sets a sample format. SAMPLEFMT can be:

0 to use the predefined setting; 8, 16, 32, 64 for integer format, F16, F32, F64 for floating point.

Not all formats are supported by all destination types. Selecting an invalid format will be reported as a command line error and a list of values printed. so it will read you if you get it wrong, but politely, with a list ๐Ÿ“‹๐Ÿ’–

Container FormatSample Format

okay so no tables here, but here's the tea by container:

  • AIFF โ€” 0, 16, 32
  • ALAC โ€” 0, 16, 24
  • WAV โ€” 0, 8, 16, 32, 64, F16, F32, F64
  • FLAC โ€” 0, 16, 24

Defaults to: 0 (Use the same as the source or the predefined format of the destination if the source format is not possible.)


๐ŸŽฌ VIDEO OPTIONS ๐ŸŽฌ

  • --videobitrate=BITRATE, -o videobitrate=BITRATE โ€” this sets the video encoding bit rate. Setting this too high or too low may cause transcoding to fail. goldilocks energy fr fr ๐Ÿ”ฅ

Defaults to: 2 Mbit

mp4: May be specified as 500 to 25,000 kbps.

๐Ÿ’— BITRATE ๐Ÿ’—

bestie a bitrate is literally just written like this, pick ur fighter:

  • n bit/s: # or #bps
  • n kbit/s: #K or #Kbps
  • n Mbit/s: #M or #Mbps

  • --videoheight=HEIGHT, -o videoheight=HEIGHT โ€” sets how TALL the transcoded video is gonna be, periodt. ๐ŸŽ€ When the video gets rescaled, the aspect ratio stays intact only if --width isn't set at the same time. Defaults to: keep source video height.
  • --videowidth=WIDTH, -o videowidth=WIDTH โ€” sets how WIDE the transcoded video is, yep that's the one. ๐ŸŒธ When the video gets rescaled, the aspect ratio is preserved if --height is not set at the same time. Defaults to: keep source video width.
  • --deinterlace, -o deinterlace โ€” deinterlaces the video if necessary while transcoding, lowkey doing the lords work. โœจ This may need a higher bit rate, but it will increase picture quality when you're streaming via HTML5. Defaults to: "no deinterlace".

๐ŸŽฌ HLS Options ๐ŸŽฌ

  • --segment_duration, -o segment_duration โ€” sets the duration of one video segment of the HLS stream. This argument is a floating point value, like, it can be set to 2.5 for 2500 milliseconds. ๐Ÿ’… Should normally be left as the default. Note: this applies to the HLS output format only and is ignored for all other formats. Defaults to: 10 seconds.
  • --min_seek_time_diff, -o min_seek_time_diff โ€” if the requested HLS segment is less than min_seek_time seconds away, discard the seek request. The segment will be available very soon anyway, and that would make a re-transcode necessary. Set to 0 to disable. ๐Ÿฆ‹ Should normally be left as the default. Note: this applies to the HLS output format only and is ignored for all other formats. Defaults to: 30 seconds.

โšก Hardware Acceleration Options โšก

  • --hwaccel_enc=API, -o hwaccel_enc=API โ€” picks the hardware acceleration API for encoding. Defaults to: NONE (no acceleration).

API

can be defined as...

  • NONE: use software encoder
  • VAAPI: Video Acceleration API (VA-API)
  • OMX: OpenMAX (Open Media Acceleration)
  • --hwaccel_dec_blocked=CODEC[:PROFILE[:PROFILE]], -o hwaccel_dec_blocked=CODEC:[:PROFILE[:PROFILE]] โ€” blocks a codec, and optionally a profile, for hardware decoding. This option can be repeated so you can block several codecs, no cap. ๐Ÿšซ Defaults to: no codecs blocked.

CODEC

can be defined as...

  • H263: H.263
  • H264: H.264
  • HEVC: H.265 / HEVC
  • MPEG2: MPEG-2 video
  • MPEG4: MPEG-4 video
  • VC1: SMPTE VC-1
  • VP8: Google VP9
  • VP9: Google VP9
  • WMV3: Windows Media Video 9

PROFILE

can optionally be added so you only block a certain profile from that codec. โœจ

Example: VP9:0 blocks Google VP profile 0.

Example: H264:1:33 blocks H.264 profile 1 and 33.

  • --hwaccel_enc_device=DEVICE, -o hwaccel_enc_device=DEVICE โ€” selects the hardware acceleration device. It may be required for VAAPI, especially if more than one device is available. ๐Ÿ‘‘ Note: this only applies to VAAPI hardware acceleration; all other types are ignored. Defaults to: empty (use default device). Example: /dev/dri/renderD128.
  • --hwaccel_dec=API, -o hwaccel_dec=API โ€” picks the hardware acceleration API for decoding. Defaults to: NONE (no acceleration)

API

can be defined as...

  • NONE: use software decoder
  • VAAPI: Video Acceleration API (VA-API)
  • MMAL: Multimedia Abstraction Layer by Broadcom
  • --hwaccel_dec_device=DEVICE, -o hwaccel_dec_device=DEVICE โ€” selects the hardware acceleration device. May be required for VAAPI, especially if more than one device is available. ๐Ÿ’œ Note: this only applies to VAAPI hardware acceleration; all other types are ignored. Defaults to: empty (use default device). Example: /dev/dri/renderD128.

๐ŸŽจ Album Arts ๐ŸŽจ

  • --noalbumarts, -o noalbumarts โ€” does NOT copy album art into the output file, we're being minimal bestie. โœจ This will reduce the file size and may be useful when streaming via HTML5, where album art isn't used anyway. Defaults to: add album arts.

๐Ÿ“œ Virtual Script ๐Ÿ“œ

  • --enablescript, -o enablescript โ€” adds a virtual index.php to every directory. It reads scripts/videotag.php from the FFmpegfs binary directory. ๐Ÿฆ‹ This can be very handy for testing video playback. Of course, feel free to replace videotag.php with your own script. Defaults to: Do not generate script file.
  • --scriptfile, -o scriptfile โ€” sets the name of the virtual script created in each directory. Defaults to: index.php.
  • --scriptsource, -o scriptsource โ€” use a different source file. Defaults to: scripts/videotag.php.

๐Ÿ’พ Cache Options ๐Ÿ’พ

  • --expiry_time=TIME, -o expiry_time=TIME โ€” cache entries expire after TIME and get deleted to save disc space, bye bestie ๐Ÿ‘‹ Defaults to: 1 week.
  • --max_inactive_suspend=TIME, -o max_inactive_suspend=TIME โ€” while the file is being accessed, it's transcoded to the target format in the background. When the client quits, transcoding continues until this timeout. Transcoding is suspended until it's accessed again, and then transcoding continues. ๐Ÿ˜ด Defaults to: 15 seconds.
  • --max_inactive_abort=TIME, -o max_inactive_abort=TIME โ€” while it's being accessed, the file is transcoded in the background to the target format. When the client quits, transcoding continues until this timeout, and then the transcoder thread quits. ๐Ÿ’€ Defaults to: 30 seconds.
  • --prebuffer_time=TIME, -o prebuffer_time=TIME โ€” files will be decoded until the buffer contains the specified playing time, letting playback start smoothly without lags. Both options must be met if prebuffer time and prebuffer size are specified. Set to 0 to disable pre-buffering. Defaults to: no prebuffer time.
  • --prebuffer_size=SIZE, -o prebuffer_size=SIZE โ€” files will be decoded until the specified number of bytes is present in the buffer, letting playback start smoothly without lags. Both options must be met if prebuffer size and prebuffer time are specified. Set to 0 to disable pre-buffering. Defaults to: 100 KB.
  • --max_cache_size=SIZE, -o max_cache_size=SIZE โ€” sets the maximum diskspace used by the cache. If the cache grows beyond this limit when a file is transcoded, old entries get deleted to keep the cache within the size limit. ๐Ÿ—‘๏ธ Defaults to: unlimited.
  • --min_diskspace=SIZE, -o min_diskspace=SIZE โ€” sets the required diskspace on the cachepath mount. If the remaining space falls below SIZE when a file is transcoded, old entries get deleted to keep the diskspace within the limit. Defaults to: 0 (no minimum space).
  • --cachepath=DIR, -o cachepath=DIR โ€” sets the disc cache directory to DIR. If it doesn't already exist, it will be created. The user running FFmpegfs must have write access to that location, fr fr. โœ๏ธ Defaults to: ${XDG_CACHE_HOME:-~/.cache}/ffmpegfs (as specified in the XDG Base Directory Specification). Falls back to ${HOME:-~/.cache}/ffmpegfs if not defined. If executed with root privileges, "/var/cache/ffmpegfs" will be used.
  • --disable_cache, -o disable_cache โ€” disables the cache functionality completely, gone, deleted, not here. ๐Ÿ™ˆ Defaults to: enabled.
  • --cache_maintenance=TIME, -o cache_maintenance=TIME โ€” starts cache maintenance in TIME intervals. This will enforce the expery_time, max_cache_size and min_diskspace settings. Do not set it too low, as this can slow down transcoding. ๐ŸŒ Only one FFmpegfs process will do the maintenance by becoming the master. If that process exits, another will take over, so that one will always do the maintenance. Defaults to: 1 hour.
  • --prune_cache โ€” prunes the cache immediately according to the above settings at application start up. โœ‚๏ธ Defaults to: Do not prune cache.
  • --clear_cache, -o clear_cache โ€” on startup, clears the cache. All previously transcoded files will be deleted. ๐Ÿ’€ Defaults: n/a.

TIME

can be defined as...

  • Seconds: #
  • Minutes: #m
  • Hours: #h
  • Days: #d
  • Weeks: #w

SIZE

can be defined as...

  • In bytes: # or #B
  • In KBytes: #K or #KB
  • In MBytes: #M or #MB
  • In GBytes: #G or #GB
  • In TBytes: #T or #TB

๐ŸŒˆ Other ๐ŸŒˆ

  • --max_threads=COUNT, -o max_threads=COUNT โ€” limits concurrent transcoder threads. Set to 0 for unlimited threads. Recommended values are up to 16 times the number of CPU cores. Should be left as the default. ๐Ÿงต Defaults to: 16 times number of detected cpu cores.
  • --decoding_errors, -o decoding_errors โ€” decoding errors are normally ignored, leaving bloopers and hiccups in the encoded audio or video but still creating a valid file. When this option is set, transcoding will stop with an error instead. ๐Ÿ›‘ Defaults to: Ignore errors.
  • --min_dvd_chapter_duration=SECONDS, -o min_dvd_chapter_duration=SECONDS โ€” ignores DVD chapters shorter than SECONDS. To disable, set to 0. This avoids transcoding errors for DVD chapters too short to detect its streams. ๐Ÿ“€ Defaults to: 1 second.
  • --win_smb_fix, -o win_smb_fix โ€” Windows seems to access the files on Samba drives starting at the last 64K segment when the file is opened. Setting --win_smb_fix=1 will ignore these attempts (not decode the file up to this point). ๐ŸชŸ Defaults to: on.

๐Ÿ“ Logging ๐Ÿ“

  • --log_maxlevel=LEVEL, -o log_maxlevel=LEVEL โ€” maximum level of messages to log, either ERROR, WARNING, INFO, DEBUG or TRACE. Defaults to INFO and is always set to DEBUG in debug mode. Note that the other log flags must also be set to enable logging. โš ๏ธ
  • --log_stderr, -o log_stderr โ€” enables outputting logging messages to stderr. Automatically enabled in debug mode. ๐ŸŒŠ
  • --log_syslog, -o log_syslog โ€” enables outputting logging messages to syslog. ๐Ÿ“ฎ
  • --logfile=FILE, -o logfile=FILE โ€” file to output log messages to. By default, no file will be written. ๐Ÿ—’๏ธ

๐Ÿ”ง General/FUSE options ๐Ÿ”ง

  • -d, -o debug โ€” enables debug output. This will result in a large quantity of diagnostic information being printed to stderr as the programme runs. It implies -f. ๐Ÿ˜ญ (so much text bestie)
  • -f โ€” run in the foreground instead of detaching from the terminal. ๐Ÿซถ
  • -h, --help โ€” print usage information. ๐Ÿ™‹
  • -V, --version โ€” output version information. ๐Ÿท๏ธ
  • -c, --capabilities โ€” dumps FFmpeg's flex: a whole list of every codec your system has available. Vibe check on your codecs, basically ๐Ÿ’…
  • -s โ€” forces single-threaded operation. One thread, one job, no multitasking drama. It's giving โœจ mindfulness โœจ

๐ŸŒˆ USAGE ๐ŸŒˆ

Mount your file system like this, bestie:

ffmpegfs [--audiobitrate bitrate] [--videobitrate bitrate] musicdir mountpoint [-o fuse_options]

Wanna run FFmpegfs as a daemon and encode to MPEG-4? Say less:

ffmpegfs --audiobitrate=256K --videobitrate=1.5M /mnt/music /mnt/ffmpegfs -o allow_other,ro,desttype=mp4

This one runs FFmpegfs in the foreground and prints the log output straight to your screen, no cap:

ffmpegfs -f --log_stderr --audiobitrate=256K --videobitrate=1.5M --audiobitrate=256K --videobitrate=1.5M /mnt/music /mnt/ffmpegfs -o allow_other,ro,desttype=mp4

With the following entry in /etc/fstab, the same result can be obtained with more recent versions of FUSE:

ffmpegfs#/mnt/music /mnt/ffmpegfs fuse allow_other,ro,audiobitrate=256K,videobitrate=2000000,desttype=mp4 0 0

Another (more current) way to express this command:

/mnt/music /mnt/ffmpegfs fuse.ffmpegfs allow_other,ro,audiobitrate=256K,videobitrate=2000000,desttype=mp4 0 0

At this point, files like /mnt/music/**.flac and /mnt/music/**.ogg will show up as /mnt/ffmpegfs/**.mp4. It's giving โœจglow upโœจ. Glow down? Whatever, you get it ๐Ÿฆ‹

Audio bitrates will be reduced to 256 KBit, video to 1.5 MBit. The source bitrate will not be scaled up if it is lower โ€” it will remain at the lower value. No inflating, we're not doing that here ๐Ÿ™…โ€โ™€๏ธ

Keep in mind that only root can, by default, utilise the "allow other" option. Either use the "user allow other" key in /etc/fuse.conf or run FFmpegfs as root. ๐Ÿ‘‘

Any user must have "allow other" enabled in order to access the mount. By default, only the user who initiated FFmpegfs has access to this. So likeโ€ฆ it's your party, and you can invite people, but you have to say so first ๐Ÿ’–

Examples:

ffmpegfs -f $HOME/test/in $HOME/test/out --log_stderr --log_maxlevel=DEBUG -o allow_other,ro,desttype=mp4,cachepath=$HOME/test/cache

Transcode files using FFmpegfs from test/in to test/out while logging to stderr at a noisy TRACE level. The cache resides in test/cache. All directories are under the current user's home directory. Cozy ๐ŸŽ€

ffmpegfs -f $HOME/test/in $HOME/test/out --log_stderr --log_maxlevel=DEBUG -o allow_other,ro,desttype=mp4,cachepath=$HOME/test/cache,videowidth=640

Similar to the previous, but with a 640-pixel maximum video width. The aspect ratio will be maintained when scaling down larger videos. Videos that are smaller won't be scaled up. Respectful of proportions, as one should be ๐Ÿ’…

ffmpegfs -f $HOME/test/in $HOME/test/out --log_stderr --log_maxlevel=DEBUG -o allow_other,ro,desttype=mp4,cachepath=$HOME/test/cache,deinterlace

Deinterlacing can be enabled for better image quality. Crispy โœจ


๐Ÿง  HOW IT WORKS ๐Ÿง 

The decoder and encoder are initialised when a file is opened, and the file's metadata is also read. At this point, a rough estimate of the total file size can be made. Because the actual size greatly depends on the material encoded, this technique works fair-to-good for MP4 or WebM output files but works well for MP3, AIFF, or WAV output files. (Guessy for the video girlies, precise for the audio ones ๐Ÿ˜Œ)

The file is transcoded as it is being read and stored in a private per-file buffer. This buffer keeps expanding as the file is read until the entire file has been transcoded. After being decoded, the file is stored in a disc buffer and is readily accessible. Like a lil snowball that becomes a whole glacier โ›„

Other processes will share the same transcoded data if they access the same file because transcoding is done in a single additional thread, which saves CPU time. Transcoding will continue for a while if all processes close the file before it is finished. Transcoding will resume if the file is viewed once more before the timer expires. If not, it will halt and delete the current chunk to free up storage space. Not me abandoning the project and clearing the cache ๐Ÿ˜ญ

A file will be transcoded up to the seek point when you seek within it (if not already done). Since the majority of programmes will read a file from beginning to end, this is typically not a problem. Future upgrades might offer actual random seeking (but if this is feasible, it is not yet clear due to restrictions to positioning inside compressed streams). When HLS streaming is chosen, this already functions. The requested segment is immediately skipped to by FFmpegfs. Queen behaviour, honestly ๐Ÿซถ

MP3: The source file's comments are used to generate ID3 version 2.4 and 1.1 tags. They are correspondingly at the beginning and the end of the file.

MP4: The same is true for meta atoms contained in MP4 containers.

WAV: The estimated size of the WAV file will be included in a pro forma WAV header. When the file is complete, this header will be changed. Though most current gamers apparently disregard this information and continue to play the file, it does not seem required.

Only for MP3 targets: A particular optimization has been done so that programmes that look for id3v1 tags don't have to wait for the entire file to be transcoded before reading the tag. This accelerates these apps dramatically. Iconic, no notes ๐Ÿ”ฅ


๐ŸŽฌ ABOUT OUTPUT FORMATS ๐ŸŽฌ

A few remarks regarding the output formats that are supported:

Since these are plain vanilla constant bitrate (CBR) MP3 files, there isn't much to say about the MP3 output. Any modern player should be able to play them well. Simple. Classic. Never misses ๐Ÿ“

However, MP4 files are unique because standard MP4s aren't really ideal for live broadcasting. The start block of an MP4 has a field with the size of the compressed data section, which is the cause. It suffices to say that until the size is known, compression must be finished, a file seek must be performed to the beginning, and the size atom updated. So likeโ€ฆ you can't write the label until you know how much is in the box ๐Ÿ“ฆ

That size is unknown for a live stream that is ongoing. To obtain that value for our transcoded files, one would need to wait for the entire file to be recoded. As if that weren't enough, the file's final section contains some crucial details, such as meta tags for the artist, album, etc. Additionally, the fact that there is just one enormous data block makes it difficult to do random searches among the contents without access to the entire data section. It's giving "spoilers at the end of the book" energy ๐Ÿ’€

Many programmes will then read the crucial information from the end of an MP4 before returning to the file's head and beginning playback. This will destroy FFmpegfs' entire transcode-on-demand concept.

Several extensions have been created to work around the restriction, including "faststart," which moves the aforementioned meta data from the end to the beginning of the MP4 file. Additionally, it is possible to omit the size field (0). An further plugin is isml (smooth live streaming).

Older versions of FFmpeg do not support several new MP4 features that are required for direct-to-stream transcoding, like ISMV, faststart, separate moof/empty moov, to mention a few (or if available, not working properly). Old FFmpeg said "not my era" ๐Ÿ˜ญ

Faststart files are produced by default with an empty size field so that the file can be started to be written out at once rather than having to be encoded as a complete first. It would take some time before playback could begin if it were fully encoded. The data part is divided into chunks of about 1 second each, all with their own header, so it is possible to fill in the size fields early enough. Chunked and cute โœจ

One disadvantage is that not all players agree with the format, or they play it with odd side effects. VLC only refreshes the time display every several seconds while playing the file. There may not always be a complete duration displayed while streaming using HTML5 video tags, but that is fine as long as the content plays. Playback can only move backwards from the current playback position. So no scrubbing ahead, sorry babe ๐Ÿ™ˆ

However, that is the cost of commencing playback quickly. Worth it, fr fr ๐Ÿ’œ


๐Ÿ’ป DEVELOPMENT ๐Ÿ’ป

Git is the revision control system used by FFmpegfs. The complete repository is available here:

git clone https://github.com/nschlia/ffmpegfs.git

or the mirror:

git clone https://salsa.debian.org/nschlia/ffmpegfs.git

FFmpegfs is composed primarily of C++17 with a small amount of C. The following libraries are utilised:

  • FUSE

FFmpeg home pages:

  • FFmpeg

๐Ÿ“‚ FILES ๐Ÿ“‚

/usr/local/bin/ffmpegfs, /etc/fstab


๐Ÿ‘‘ AUTHORS ๐Ÿ‘‘

This fork with FFmpeg support has been maintained by Norbert Schlia since 2017 to date.

Based on work by K. Henriksson (from 2008 to 2017) and the original author, David Collett (from 2006 to 2008).

Much thanks to them for the original work and giving me a good head start! ๐Ÿซถ


๐Ÿ“œ LICENSE ๐Ÿ“œ

This program can be distributed under the terms of the GNU GPL version 3 or later. It can be found online or in the COPYING file.

This file and other documentation files can be distributed under the terms of the GNU Free Documentation License 1.3 or later. It can be found online or in the COPYING.DOC file.


๐ŸŽฅ FFMPEG LICENSE ๐ŸŽฅ

FFmpeg is licensed under the GNU Lesser General Public License (LGPL) version 2.1 or later. However, FFmpeg incorporates several optional parts and optimizations that are covered by the GNU General Public License (GPL) version 2 or later. If those parts get used the GPL applies to all of FFmpeg.

See https://www.ffmpeg.org/legal.html for details.


This fork with FFmpeg support copyright (C) 2017-2026 Norbert Schlia.

Based on work copyright (C) 2006-2008 David Collett, 2008-2013 K. Henriksson.

Much thanks to them for the original work! ๐Ÿ’–

This is free software: you are free to change and redistribute it under the terms of the GNU General Public License (GPL) version 3 or later.

This manual is copyright (C) 2010-2011 K. Henriksson and (C) 2017-2026 by N. Schlia and may be distributed under the GNU Free Documentation License (GFDL) 1.3 or later with no invariant sections, or alternatively under the GNU General Public License (GPL) version 3 or later.


and that's the whole page, bestie!! ๐ŸŽ€ This lil legend is from ffmpegfs 2.50, stamped Juni 2026, and honestly? She ate. Now go mount something and transcode ur heart out ๐Ÿ’…โœจ๐Ÿฆ‹๐ŸŒธ

๐Ÿ“ฆ where this page comes from