[Bug]: Transcoding fails when streams directory contains spaces #2462

Closed
opened 2026-04-25 00:07:24 +02:00 by adam · 1 comment
Owner

Originally created by @mikiher on GitHub (Jan 4, 2025).

What happened?

Tried to stream a book on iOS web client (on an iPad).
Got message "Stream Failed: undefined".

Server logs below

What did you expect to happen?

Book should have played.

Steps to reproduce the issue

  1. Work with a server where the metadata directory contains spaces (in my case, F:\VS Code Worksapces\audiobookshelf-local\audiobookshelf\metadata)
  2. Choose a book that requires transcoding
  3. Try to play it

Audiobookshelf version

v2.17.7

How are you running audiobookshelf?

Built from source

What OS is your Audiobookshelf server hosted from?

Windows

If the issue is being seen in the UI, what browsers are you seeing the problem on?

Safari on iOS

Logs

2025-01-04 18:54:28.146

DEBUG

[PlaybackSessionManager] "user" starting stream session for item "16919e80-c190-4b39-8deb-b5cc20293151" (Device: Mac OS 10.15.7 / Safari)

2025-01-04 18:54:28.150

INFO

[STREAM] START STREAM - Num Segments: 10482

2025-01-04 18:54:28.191

INFO

[INFO] FFMPEG transcoding started with command: ffmpeg -seek_timestamp 1 -f concat -safe 0 -i F:\VS Code Worksapces\audiobookshelf-local\audiobookshelf\metadata\streams\e0d522d1-6372-4555-ad36-4fb33695c3c8\files.txt -y -loglevel warning -map 0:a -c:a copy -f hls -copyts -avoid_negative_ts make_non_negative -max_delay 5000000 -max_muxing_queue_size 2048 -hls_time 6 -hls_segment_type mpegts -start_number 0 -hls_playlist_type vod -hls_list_size 0 -hls_allow_cache 0 -hls_segment_filename F:\VS Code Worksapces\audiobookshelf-local\audiobookshelf\metadata\streams\e0d522d1-6372-4555-ad36-4fb33695c3c8\output-%d.ts F:\VS Code Worksapces\audiobookshelf-local\audiobookshelf\metadata\streams\e0d522d1-6372-4555-ad36-4fb33695c3c8\final-output.m3u8

2025-01-04 18:54:28.191

INFO


2025-01-04 18:54:28.210

INFO

Unrecognized option 'hls_segment_filename F:\VS Code Worksapces\audiobookshelf-local\audiobookshelf\metadata\streams\e0d522d1-6372-4555-ad36-4fb33695c3c8\output-%d.ts'.

2025-01-04 18:54:28.210

INFO

Error splitting the argument list: Option not found

2025-01-04 18:54:28.211

INFO


2025-01-04 18:54:28.213

ERROR

Ffmpeg Err "ffmpeg exited with code 1: Unrecognized option 'hls_segment_filename F:\VS Code Worksapces\audiobookshelf-local\audiobookshelf\metadata\streams\e0d522d1-6372-4555-ad36-4fb33695c3c8\output-%d.ts'. Error splitting the argument list: Option not found "

Additional Notes

No response

Originally created by @mikiher on GitHub (Jan 4, 2025). ### What happened? Tried to stream a book on iOS web client (on an iPad). Got message "Stream Failed: undefined". Server logs below ### What did you expect to happen? Book should have played. ### Steps to reproduce the issue 1. Work with a server where the metadata directory contains spaces (in my case, `F:\VS Code Worksapces\audiobookshelf-local\audiobookshelf\metadata`) 2. Choose a book that requires transcoding 3. Try to play it ### Audiobookshelf version v2.17.7 ### How are you running audiobookshelf? Built from source ### What OS is your Audiobookshelf server hosted from? Windows ### If the issue is being seen in the UI, what browsers are you seeing the problem on? Safari on iOS ### Logs ```shell 2025-01-04 18:54:28.146 DEBUG [PlaybackSessionManager] "user" starting stream session for item "16919e80-c190-4b39-8deb-b5cc20293151" (Device: Mac OS 10.15.7 / Safari) 2025-01-04 18:54:28.150 INFO [STREAM] START STREAM - Num Segments: 10482 2025-01-04 18:54:28.191 INFO [INFO] FFMPEG transcoding started with command: ffmpeg -seek_timestamp 1 -f concat -safe 0 -i F:\VS Code Worksapces\audiobookshelf-local\audiobookshelf\metadata\streams\e0d522d1-6372-4555-ad36-4fb33695c3c8\files.txt -y -loglevel warning -map 0:a -c:a copy -f hls -copyts -avoid_negative_ts make_non_negative -max_delay 5000000 -max_muxing_queue_size 2048 -hls_time 6 -hls_segment_type mpegts -start_number 0 -hls_playlist_type vod -hls_list_size 0 -hls_allow_cache 0 -hls_segment_filename F:\VS Code Worksapces\audiobookshelf-local\audiobookshelf\metadata\streams\e0d522d1-6372-4555-ad36-4fb33695c3c8\output-%d.ts F:\VS Code Worksapces\audiobookshelf-local\audiobookshelf\metadata\streams\e0d522d1-6372-4555-ad36-4fb33695c3c8\final-output.m3u8 2025-01-04 18:54:28.191 INFO 2025-01-04 18:54:28.210 INFO Unrecognized option 'hls_segment_filename F:\VS Code Worksapces\audiobookshelf-local\audiobookshelf\metadata\streams\e0d522d1-6372-4555-ad36-4fb33695c3c8\output-%d.ts'. 2025-01-04 18:54:28.210 INFO Error splitting the argument list: Option not found 2025-01-04 18:54:28.211 INFO 2025-01-04 18:54:28.213 ERROR Ffmpeg Err "ffmpeg exited with code 1: Unrecognized option 'hls_segment_filename F:\VS Code Worksapces\audiobookshelf-local\audiobookshelf\metadata\streams\e0d522d1-6372-4555-ad36-4fb33695c3c8\output-%d.ts'. Error splitting the argument list: Option not found " ``` ### Additional Notes _No response_
adam added the bug label 2026-04-25 00:07:24 +02:00
adam closed this issue 2026-04-25 00:07:24 +02:00
Author
Owner

@mikiher commented on GitHub (Jan 4, 2025):

This is caused by incorrect usage of ffmpeg.addOption in Stream.js.

When passing a single string to addOption, it tries to parse it, and if it contains more than one space, it tries to split it into several options (and it doesn't matter if you try to put quotes around the option value).

So when the option value potentially contains spaces (like filenames), you have to use the addOption variant that accepts two strings (one for the option name, and one for the value), otherwise it might cause errors (I think I already encountered and fixed a couple of those when working on ffmpegHelpers.js)

I'm sending a fix.

@mikiher commented on GitHub (Jan 4, 2025): This is caused by incorrect usage of `ffmpeg.addOption` in `Stream.js`. When passing a single string to `addOption`, it tries to parse it, and if it contains more than one space, it tries to split it into several options (and it doesn't matter if you try to put quotes around the option value). So when the option value potentially contains spaces (like filenames), you have to use the addOption variant that accepts two strings (one for the option name, and one for the value), otherwise it might cause errors (I think I already encountered and fixed a couple of those when working on `ffmpegHelpers.js`) I'm sending a fix.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#2462