mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-05-30 23:40:40 +02:00
[Enhancement]: Smart speed / trim silence #2330
Open
opened 2026-04-25 00:06:10 +02:00 by adam
·
12 comments
No Branch/Tag Specified
master
book_tags_genres_dedupe
episode_download_fallback
Issue-4540-SortBy-StartedDate-and-FinishedDate
episode_meta_tagging
fix_authorize_race_condition
redirect_transcode_requests
progress_updated_sort
fix_ereader_socket_event
fix_change_empty_root_password
fix_podcast_session_track_index
fix_set_token
session_modal_user
localize_durations
fix_oidc_create_user
jwt_auth_refactor
fix_scanner_deleting_single_file_books
fix_mediaprogress_updatedat_2
experimental_next_client
podcast_episode_duration
episode-timestamps-clickable
book_author_secondary_sort_title
podcast_useragents
pathexists_user_access
fix_pathexists_join
book_author_secondary_sort
clean_duplicate_mediaprogress
sanitize_html_description
trix_prevent_attachments
check_path_api_fix
fix_mediaprogress_updatedat
increase_express_json_limit
fix_dockerfile_nunicode
search_episodes
audiobook_tools_update
episode_secondary_sorts
hls_stream_url_update
new_session_track_endpoint
audiobook_tools_enhancements
watcher_rescans_update
player_track_tooltip
fix_exclude_prefixes_crash
socket_item_events
fix_podcast_episode_scanner_promise
new_stats_controller
count_cache_for_userpermissions
parsing-opf-v3
validate_migration_files
fix-quick-match-all-crash
fix-chapter-end-sleep-timer
stringify_sequelize_query
remove-col-ambiguity
fix_next_prev_edit_description
details_trim_whitespace
fix_content_url_basepath
fix_logger_fatal
progress_bar_visibility
batch-edit-populate-map-details
feed_generator_updates
bookmark-modal-updates
migrate-library-item-in-scanner
migrate-new-library-items
migrate-podcasts-new-library-item-2
migrate-podcasts-new-library-item
fix-remove-episode-from-playlist
playback-session-use-new-library-item
refactor-library-item
fix-heatmap-caption
feed-episodes-upsert
share-media-player-media-session-api
remove-old-playlist
remove_old_collection_object
plugin-implementation-demo
feed_migration
refactor-feeds-from-item
fix_remove_authors_no_books
v2.17.3-fk-constraints-migration
migrations-first-upgrade
sqlite_2
feature/nuxt-target-server
waveform
sqlite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.3.4
v1.3.3
v1.3.1
v1.2.8
v1.2.6
v1.2.5
v1.2.4
v1.2.1
v1.1.15
v1.1.14
v1.1.13
v1.1.12
v1.1.11
v1.1.10
v1.1.9
v1.1.8
v1.0.0
0.9.61-beta.0
0.9.61-beta
Labels
Clear labels
authentication
backlog
bug
chapter editor
config-issue
ebooks
encoding/embedding
enhancement
help wanted
listening sessions & progress
planned
possible plugin
progress sync
pull-request
sorting/filtering/searching
unable to reproduce
upload
users & permissions
waiting
Mirrored from GitHub Pull Request
No Label
enhancement
Milestone
No items
No Milestone
Projects
Clear projects
No project
Assignees
adam (Adam Melkus)
Clear assignees
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: starred/audiobookshelf#2330
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @DankMemeGuy on GitHub (Oct 28, 2024).
Type of Enhancement
None
Describe the Feature/Enhancement
Podcasting software "Overcast" includes a SmartSpeed feature that intelligently trims pauses in audio playback. This feature can result in a time savings of approximately 10-20% during playback. For podcasts or audiobooks, enabling this could significantly reduce listening time without altering the natural flow of the audio.
You can read more here https://medium.com/@eped/overcasts-smart-speed-vs-real-time-a759549ab48b
Why would this be helpful?
This feature would enhance the user experience by allowing listeners to consume content more efficiently, saving time while maintaining audio quality. It’s particularly useful for lengthy content like audiobooks and long-form podcasts, where small pauses add up, making the listening process quicker and more seamless.
Future Implementation (Screenshot)
Not needed
Audiobookshelf Server Version
2.16
Current Implementation (Screenshot)
No response
@pwinnski commented on GitHub (Oct 30, 2024):
That feature is the result of Marco Arment having developed a custom audio engine for iOS. It is 100% a mobile client feature, and the result of a unique and huge effort by a very talented developer. It is also very much iOS/iPadOS/WatchOS only.
All that to say, there's a reason that Overcast is the only app that does that, even ten years later! https://marco.org/2014/07/16/overcast
@DankMemeGuy commented on GitHub (Nov 1, 2024):
I think it was more challenging in 2015 when he was building out his software, but times have changed. When using ChatGPT, this is what it suggested:
To implement an on-the-fly "Smart Speed" feature within AudioBookShelf, we’d ideally modify its playback engine to handle dynamic silence reduction during streaming rather than preprocessing the audio file. Since AudioBookShelf is a Node.js application, we'll focus on integrating this functionality within a Node.js audio pipeline.
Here's how you might go about adding this feature using
ffmpegto process audio in real-time. The following example script usesffmpegto dynamically remove silence and stream audio back to the player.Prerequisites
Ensure
ffmpegis installed on your server, as it will perform real-time audio processing. You can install it using:Real-Time Silence Reduction in Node.js
Here’s an example of how you could add real-time silence reduction to AudioBookShelf's playback by creating a middleware function to process the audio stream. This approach hooks into the stream, detects silence, and trims it in real time before streaming the output to the player.
Explanation of the Code
FFmpeg Audio Filter: We use the
silenceremovefilter from FFmpeg, which detects and removes silence based on customizable thresholds:start_periods=1: Starts trimming after detecting one period of silence.start_silence=0.5: Defines silence as any pause lasting 0.5 seconds or longer.start_threshold=-40dB: Treats segments quieter than -40 dB as silence.detection=peak: Uses peak values for detecting silence.Streaming with Express: This code sets up an Express route (
/stream/:audioFile) to serve processed audio on-the-fly. FFmpeg streams directly to the client by piping itsstdoutto the HTTP response.Handling Connections: The server closes the FFmpeg process if the client disconnects (
req.on('close')), saving resources.Integration into AudioBookShelf
To integrate this directly into AudioBookShelf, you would:
ffmpegprocessing stream.This approach avoids the need to pre-process entire files while providing an on-the-fly "Smart Speed" feature similar to Overcast's Smart Speed. This setup is suitable for streaming-based applications and works well within Node.js-based frameworks like AudioBookShelf.
Relevant:
That would be a streaming option, but a pre-processed option would be less intensive, but more storage (assuming the original file is kept intact). Unless I guess having an option at the time of upload on whether to trim silence, and whether to preserve the original or not. That would save the complexity of re-writing the audio engine since it would just need that FFMPEG pipeline at upload stage
@TaylorMichaelHall commented on GitHub (Nov 5, 2024):
Pocketcasts has been doing this for about as long - https://support.pocketcasts.com/knowledge-base/playback-effects/#htoc-trim-silence
@Terminal-Grasshopper commented on GitHub (Jan 10, 2025):
this issue should be renamed to "trim silence" rather than "smart speed"
and yes it is an amazing feature in pocketcasts, UI/UX can be found in the link @TaylorMichaelHall inserted
@smeinecke commented on GitHub (Apr 19, 2025):
NewPipe (alternative android youtube client) has the same feature (named
SkipSilence).@jonbaldie commented on GitHub (May 15, 2025):
Good news all, I've actually developed this feature in a local copy of the branch and it seems to work well in my tests:
I actually tried to push up to a feature branch and open a PR but I got a 403, does the maintainer need to activate write permissions per GitHub user or something?
cc. @DankMemeGuy @TaylorMichaelHall et. al
@nichwall commented on GitHub (May 15, 2025):
You need to do your work in a fork and open a PR from your fork.
@jonbaldie commented on GitHub (May 16, 2025):
@nichwall good to know, thanks. I'm a little busy today so I'll do this next week.
@DankMemeGuy commented on GitHub (Jul 31, 2025):
This is wonderful! I'm glad I checked back in on this. I was listening to the books over the summer and thought of the feature again. Looking forward to it
@timespacedecay commented on GitHub (Aug 6, 2025):
🙏 Is this still something that can be implemented? This is such a great feature, I hope so! Thanks for your time and effort on it!
@scrollop commented on GitHub (Feb 26, 2026):
Is it possible
Could you share the fork?
@corbin-zip commented on GitHub (Mar 14, 2026):
@scrollop
fork is on the user's profile here: https://github.com/jonbaldie/audiobookshelf/tree/feature/smart-speed-toggle
commits are available here: https://github.com/advplyr/audiobookshelf/compare/master...jonbaldie:audiobookshelf:feature/smart-speed-toggle
I would really love to see this feature! But I don't personally have the time to repackage @jonbaldie 's work and submit a PR (and I have essentially no experience with JavaScript). Perhaps the author or someone else on this thread has the time.
This is the only feature keeping me on AntennaPod for my podcast listening so I'd love to see this implemented.
Corbin