Sound not match the time, when reopen stream #60

Closed
opened 2026-04-24 22:57:24 +02:00 by adam · 18 comments
Owner

Originally created by @svdztn on GitHub (Oct 19, 2021).

When playing in the middle of a chapter, then press the close button of the player to cancel the stream.
And play the book again, the sound jump to somewhere(in my case is the begin of the chapter), but the time shows correct with the history record. If I press seekback or seekforward, it works back to normal.

This happens on both Android and Browser.

version: 1.4.12

P.S.
Another similar problem, if I add some new audio files to a book that already exists, and rescan.
Sometimes the file playing order is different from the list.
Forexample, play from the begin of the book, the sound is not the 1st file, but the time shows correct.
I have to delete the book and rescan again, then it works.

Originally created by @svdztn on GitHub (Oct 19, 2021). When playing in the middle of a chapter, then press the close button of the player to cancel the stream. And play the book again, the sound jump to somewhere(in my case is the begin of the chapter), but the time shows correct with the history record. If I press seekback or seekforward, it works back to normal. This happens on both Android and Browser. version: 1.4.12 > P.S. > Another similar problem, if I add some new audio files to a book that already exists, and rescan. > Sometimes the file playing order is different from the list. > Forexample, play from the begin of the book, the sound is not the 1st file, but the time shows correct. > I have to delete the book and rescan again, then it works.
adam closed this issue 2026-04-24 22:57:24 +02:00
Author
Owner

@svdztn commented on GitHub (Oct 21, 2021):

It seems happens on the files after 60min.

image

@svdztn commented on GitHub (Oct 21, 2021): It seems happens on the files after 60min. ![image](https://user-images.githubusercontent.com/39606957/138193705-b21b0fb1-1636-4b9f-88f0-a5599e03a4e5.png)
Author
Owner

@advplyr commented on GitHub (Oct 21, 2021):

I'm testing this now on desktop and cannot reproduce the issue.

Have you experienced this with all of your audiobooks?
What is the audio format that you are using?

@advplyr commented on GitHub (Oct 21, 2021): I'm testing this now on desktop and cannot reproduce the issue. Have you experienced this with all of your audiobooks? What is the audio format that you are using?
Author
Owner

@svdztn commented on GitHub (Oct 22, 2021):

Yes, all audiobooks have this.
Format: mp3 and m4a.
I am using docker to run the server.

@svdztn commented on GitHub (Oct 22, 2021): Yes, all audiobooks have this. Format: mp3 and m4a. I am using docker to run the server.
Author
Owner

@svdztn commented on GitHub (Oct 22, 2021):

@advplyr
I think I found where the problem is.

When I press the close button of the player.
The server delete metadata/streams:

Deleted session data /metadata/streams/kv1q16nc

Reopen the audiobook.
The server regenerate stream:

2021-10-22 01:58:15 INFO Open Stream Request 9FZrXU_McYSQZwvVAAAN kv1owyg0 
2021-10-22 01:58:15 INFO [STREAM] User has progress for audiobook 0.134 Time Remaining: 6521.699745s 
2021-10-22 01:58:15 INFO [STREAM] START STREAM - Num Segments: 1255 
2021-10-22 01:58:15 INFO Stream Opened for client root for audiobook 流浪地球 with streamId kv1q4tr8 
2021-10-22 01:58:15 INFO [STREAM] Starting Stream at startTime 16:48 and Segment #168 
2021-10-22 01:58:15 INFO [INFO] FFMPEG transcoding started with command: ffmpeg -f concat -safe 0 -ss 63.63825500000007 -noaccurate_seek -i /metadata/streams/kv1q4tr8/files.txt -y -loglevel error -map 0:a -c:a copy -f hls -copyts -avoid_negative_ts disabled -max_delay 5000000 -max_muxing_queue_size 2048 -hls_time 6 -hls_segment_type mpegts -start_number 168 -hls_playlist_type vod -hls_list_size 0 -hls_allow_cache 0 -hls_segment_filename /metadata/streams/kv1q4tr8/output-%d.ts /metadata/streams/kv1q4tr8/final-output.m3u8 
2021-10-22 01:58:15 INFO 
2021-10-22 01:58:15 DEBUG [DB] Updated user 1 
2021-10-22 01:58:16 INFO [hls @ 0x55eccd088280] Cannot use rename on non file protocol, this may lead to races and temporary partial files 
2021-10-22 01:58:16 INFO 
2021-10-22 01:58:16 INFO [FFMPEG] Transcoding ended 
2021-10-22 01:58:16 INFO [STREAM] kv1q4tr8 notifying client that stream is ready 
2021-10-22 01:58:17 DEBUG [Stream] Updated client current time 16:48 
2021-10-22 01:58:17 DEBUG [DB] Updated entity user: 1 

The ts files are start from -start_number 168, but output-186.ts is the beginning of the 1st file in files.txt, it seems the -ss option does not take effect.

I played the file output-186.ts manually, it is the beginning of the original audio file indeed, no 63s offset.

At this time, if I press seekbackward or select a earlier time on the progressbar, the server will regenerate again.
And it starts from the beginning of the previous file.

2021-10-22 01:59:06 WARN File path does not exist /metadata/streams/kv1q4tr8/output-122.ts 
2021-10-22 01:59:06 WARN [STREAM] Segment #122 Request @12:12 is before start time (16:48) - Reset Transcode 
2021-10-22 01:59:06 INFO Stream Reset New Start Time 12:00 
2021-10-22 01:59:06 INFO [STREAM] START STREAM - Num Segments: 1255 
2021-10-22 01:59:06 INFO [HLS-CONTROLLER] Resetting Stream - notify client @732s 
2021-10-22 01:59:06 INFO [STREAM] Starting Stream at startTime 12:00 and Segment #120 
2021-10-22 01:59:06 INFO [INFO] FFMPEG transcoding started with command: ffmpeg -f concat -safe 0 -ss 720 -noaccurate_seek -i /metadata/streams/kv1q4tr8/files.txt -y -loglevel error -map 0:a -c:a copy -f hls -copyts -avoid_negative_ts disabled -max_delay 5000000 -max_muxing_queue_size 2048 -hls_time 6 -hls_segment_type mpegts -start_number 120 -hls_playlist_type vod -hls_list_size 0 -hls_allow_cache 0 -hls_segment_filename /metadata/streams/kv1q4tr8/output-%d.ts /metadata/streams/kv1q4tr8/final-output.m3u8 
2021-10-22 01:59:06 INFO 
2021-10-22 01:59:06 INFO [STREAM] Clearing isResetting 
2021-10-22 01:59:07 DEBUG [Stream] Updated client current time 12:12 
2021-10-22 01:59:07 DEBUG [DB] Updated entity user: 1 
2021-10-22 01:59:07 INFO [hls @ 0x558b0eca70c0] Cannot use rename on non file protocol, this may lead to races and temporary partial files 
2021-10-22 01:59:07 INFO 
2021-10-22 01:59:07 INFO [FFMPEG] Transcoding ended

When I switch between audiobook, if I seekbackward a little time to pick up where I left off last time, regenerate large audiobooks may spend long time. (maybe my machine is too poor (>﹏<))

@svdztn commented on GitHub (Oct 22, 2021): @advplyr I think I found where the problem is. **When I press the close button of the player.** The server delete metadata/streams: ``` Deleted session data /metadata/streams/kv1q16nc ``` **Reopen the audiobook.** The server regenerate stream: ``` 2021-10-22 01:58:15 INFO Open Stream Request 9FZrXU_McYSQZwvVAAAN kv1owyg0 2021-10-22 01:58:15 INFO [STREAM] User has progress for audiobook 0.134 Time Remaining: 6521.699745s 2021-10-22 01:58:15 INFO [STREAM] START STREAM - Num Segments: 1255 2021-10-22 01:58:15 INFO Stream Opened for client root for audiobook 流浪地球 with streamId kv1q4tr8 2021-10-22 01:58:15 INFO [STREAM] Starting Stream at startTime 16:48 and Segment #168 2021-10-22 01:58:15 INFO [INFO] FFMPEG transcoding started with command: ffmpeg -f concat -safe 0 -ss 63.63825500000007 -noaccurate_seek -i /metadata/streams/kv1q4tr8/files.txt -y -loglevel error -map 0:a -c:a copy -f hls -copyts -avoid_negative_ts disabled -max_delay 5000000 -max_muxing_queue_size 2048 -hls_time 6 -hls_segment_type mpegts -start_number 168 -hls_playlist_type vod -hls_list_size 0 -hls_allow_cache 0 -hls_segment_filename /metadata/streams/kv1q4tr8/output-%d.ts /metadata/streams/kv1q4tr8/final-output.m3u8 2021-10-22 01:58:15 INFO 2021-10-22 01:58:15 DEBUG [DB] Updated user 1 2021-10-22 01:58:16 INFO [hls @ 0x55eccd088280] Cannot use rename on non file protocol, this may lead to races and temporary partial files 2021-10-22 01:58:16 INFO 2021-10-22 01:58:16 INFO [FFMPEG] Transcoding ended 2021-10-22 01:58:16 INFO [STREAM] kv1q4tr8 notifying client that stream is ready 2021-10-22 01:58:17 DEBUG [Stream] Updated client current time 16:48 2021-10-22 01:58:17 DEBUG [DB] Updated entity user: 1 ``` The `ts` files are start from `-start_number 168`, but `output-186.ts` is the beginning of the 1st file in `files.txt`, ***it seems the `-ss` option does not take effect***. > I played the file `output-186.ts` manually, it is the beginning of the original audio file indeed, no 63s offset. **At this time, if I press seekbackward or select a earlier time on the progressbar, the server will regenerate again.** And it starts from the beginning of the previous file. ``` 2021-10-22 01:59:06 WARN File path does not exist /metadata/streams/kv1q4tr8/output-122.ts 2021-10-22 01:59:06 WARN [STREAM] Segment #122 Request @12:12 is before start time (16:48) - Reset Transcode 2021-10-22 01:59:06 INFO Stream Reset New Start Time 12:00 2021-10-22 01:59:06 INFO [STREAM] START STREAM - Num Segments: 1255 2021-10-22 01:59:06 INFO [HLS-CONTROLLER] Resetting Stream - notify client @732s 2021-10-22 01:59:06 INFO [STREAM] Starting Stream at startTime 12:00 and Segment #120 2021-10-22 01:59:06 INFO [INFO] FFMPEG transcoding started with command: ffmpeg -f concat -safe 0 -ss 720 -noaccurate_seek -i /metadata/streams/kv1q4tr8/files.txt -y -loglevel error -map 0:a -c:a copy -f hls -copyts -avoid_negative_ts disabled -max_delay 5000000 -max_muxing_queue_size 2048 -hls_time 6 -hls_segment_type mpegts -start_number 120 -hls_playlist_type vod -hls_list_size 0 -hls_allow_cache 0 -hls_segment_filename /metadata/streams/kv1q4tr8/output-%d.ts /metadata/streams/kv1q4tr8/final-output.m3u8 2021-10-22 01:59:06 INFO 2021-10-22 01:59:06 INFO [STREAM] Clearing isResetting 2021-10-22 01:59:07 DEBUG [Stream] Updated client current time 12:12 2021-10-22 01:59:07 DEBUG [DB] Updated entity user: 1 2021-10-22 01:59:07 INFO [hls @ 0x558b0eca70c0] Cannot use rename on non file protocol, this may lead to races and temporary partial files 2021-10-22 01:59:07 INFO 2021-10-22 01:59:07 INFO [FFMPEG] Transcoding ended ``` > When I switch between audiobook, if I seekbackward a little time to pick up where I left off last time, regenerate large audiobooks may spend long time. (maybe my machine is too poor (>﹏<))
Author
Owner

@svdztn commented on GitHub (Oct 22, 2021):

@advplyr
Put -ss option after -i works.

Stream.js:
image

@svdztn commented on GitHub (Oct 22, 2021): @advplyr Put `-ss` option after `-i` works. `Stream.js`: ![image](https://user-images.githubusercontent.com/39606957/138404483-cc095145-08ef-45e7-b887-f7f70b32a31a.png)
Author
Owner

@advplyr commented on GitHub (Oct 23, 2021):

I'm wondering if this could be a difference with your audio files.

Looking at the ffmpeg docs: https://trac.ffmpeg.org/wiki/Seeking
Placing the -ss before -i is "input seeking", placing it after is "output seeking".
Output seeking: the input will be decoded (and discarded) until it reaches the position given by -ss.

If we can get this working with input seeking then I think that is preferable. The docs are all talking about video, so it doesn't all apply, but I think the basic concept is the same. Output seeking will be slower.

You are saying the -ss is ignored, which makes me think that maybe the timestamp is off. I just pushed an update where I changed an hls option to:

"-avoid_negative_ts make_non_negative"

If you can pull that update and try it out maybe that will fix it.

@advplyr commented on GitHub (Oct 23, 2021): I'm wondering if this could be a difference with your audio files. Looking at the ffmpeg docs: https://trac.ffmpeg.org/wiki/Seeking Placing the `-ss` before `-i` is "input seeking", placing it after is "output seeking". Output seeking: `the input will be decoded (and discarded) until it reaches the position given by -ss.` If we can get this working with input seeking then I think that is preferable. The docs are all talking about video, so it doesn't all apply, but I think the basic concept is the same. Output seeking will be slower. You are saying the `-ss` is ignored, which makes me think that maybe the timestamp is off. I just pushed an update where I changed an hls option to: ``` "-avoid_negative_ts make_non_negative" ``` If you can pull that update and try it out maybe that will fix it.
Author
Owner

@svdztn commented on GitHub (Oct 24, 2021):

I think it did not.

2021-10-24 01:18:19  INFO  [STREAM] START STREAM - Num Segments: 954
2021-10-24 01:18:19  INFO  Stream Opened for ....
2021-10-24 01:18:19  INFO  [STREAM] Starting Stream at startTime 23:16 and Segment #232
2021-10-24 01:18:19  INFO  [INFO] FFMPEG transcoding started with command: ffmpeg -f concat -safe 0 -ss 283.07691699999987 -noaccurate_seek -i /metadata/streams/kv4jl6ql/files.txt -y -loglevel error -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 232 -hls_playlist_type vod -hls_list_size 0 -hls_allow_cache 0 -hls_segment_filename /metadata/streams/kv4jl6ql/output-%d.ts /metadata/streams/kv4jl6ql/final-output.m3u8

image
image

@svdztn commented on GitHub (Oct 24, 2021): I think it did not. ``` 2021-10-24 01:18:19 INFO [STREAM] START STREAM - Num Segments: 954 2021-10-24 01:18:19 INFO Stream Opened for .... 2021-10-24 01:18:19 INFO [STREAM] Starting Stream at startTime 23:16 and Segment #232 2021-10-24 01:18:19 INFO [INFO] FFMPEG transcoding started with command: ffmpeg -f concat -safe 0 -ss 283.07691699999987 -noaccurate_seek -i /metadata/streams/kv4jl6ql/files.txt -y -loglevel error -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 232 -hls_playlist_type vod -hls_list_size 0 -hls_allow_cache 0 -hls_segment_filename /metadata/streams/kv4jl6ql/output-%d.ts /metadata/streams/kv4jl6ql/final-output.m3u8 ``` ![image](https://user-images.githubusercontent.com/39606957/138576348-098a03ec-c67b-4a20-a774-75d859321c1a.png) ![image](https://user-images.githubusercontent.com/39606957/138576358-dd4354a8-3aa5-4ba5-b093-ebbe32c7a097.png)
Author
Owner

@svdztn commented on GitHub (Oct 24, 2021):

I tried to change -ss 283.07691699999987 with -ss 283.07 or -ss 283, .mp3 file is ok now, but .m4a not.

@svdztn commented on GitHub (Oct 24, 2021): I tried to change `-ss 283.07691699999987` with `-ss 283.07` or `-ss 283`, `.mp3` file is ok now, but `.m4a` not.
Author
Owner

@advplyr commented on GitHub (Oct 24, 2021):

I need to be able to reproduce this on my end. Can you test this with an audiobook we can both access, then share the steps for me to reproduce it?

There are a lot of audiobooks as mp3 zip files here: https://www.openculture.com/freeaudiobooks
or anywhere else. LibriVox has public domain audiobooks but something is up with their ssl certificate and I can't download anything there.

@advplyr commented on GitHub (Oct 24, 2021): I need to be able to reproduce this on my end. Can you test this with an audiobook we can both access, then share the steps for me to reproduce it? There are a lot of audiobooks as mp3 zip files here: https://www.openculture.com/freeaudiobooks or anywhere else. LibriVox has public domain audiobooks but something is up with their ssl certificate and I can't download anything there.
Author
Owner

@svdztn commented on GitHub (Oct 24, 2021):

I think the problem has to do with audio files.
The pts and dts are not from 0.

[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fe734dcc780] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fe734dcc780] ISO: File Type Major Brand: M4A 
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fe734dcc780] Unknown dref type 0x206c7275 size 12
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fe734dcc780] Processing st: 0, edit list 0 - media time: 5058, duration: 58061972
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fe734dcc780] drop a frame at curr_cts: 0 @ 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fe734dcc780] drop a frame at curr_cts: 2048 @ 1
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fe734dcc780] skip 962 audio samples from curr_cts: 4096
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fe734dcc780] Before avformat_find_stream_info() pos: 125571 bytes read:146819 seeks:0 nb_streams:1
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fe734dcc780] demuxer injecting skip 5058 / discard 0
[aac @ 0x7fe7341b5180] skip 10116 / discard 0 samples due to side data
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fe734dcc780] All info found
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fe734dcc780] After avformat_find_stream_info() pos: 125942 bytes read:146819 seeks:0 frames:1

[concat @ 0x7fe73522c180] Before avformat_find_stream_info() pos: 110 bytes read:110 seeks:0 nb_streams:1
[concat @ 0x7fe73522c180] file:0 stream:0 pts:-5058 pts_time:-0.114694 dts:-5058 dts_time:-0.114694 -> pts:-5058 pts_time:-0.114694 dts:-5058 dts_time:-0.114694
[aac @ 0x7fe734d32180] skip 10116 / discard 0 samples due to side data
[concat @ 0x7fe73522c180] All info found
[concat @ 0x7fe73522c180] After avformat_find_stream_info() pos: 110 bytes read:110 seeks:0 frames:1
/metadata/streams/kv529xxl/files.txt: could not seek to position 277.885
Input #0, concat, from '/metadata/streams/kv529xxl/files.txt':
  Duration: 00:21:56.60, start: -0.114694, bitrate: N/A
    Stream #0:0(und), 1, 1/44100: Audio: aac (HE-AAC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 64 kb/s
    Metadata:
      handler_name    : SoundHandler
Successfully opened the file.

If I only stream a specific audio file, the -ss works. But with concat, it does not.

I can send you my audio files that can reproduce this if you give me an e-mail addr or some place else.

@svdztn commented on GitHub (Oct 24, 2021): I think the problem has to do with audio files. The `pts` and `dts` are not from 0. ``` [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fe734dcc780] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fe734dcc780] ISO: File Type Major Brand: M4A [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fe734dcc780] Unknown dref type 0x206c7275 size 12 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fe734dcc780] Processing st: 0, edit list 0 - media time: 5058, duration: 58061972 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fe734dcc780] drop a frame at curr_cts: 0 @ 0 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fe734dcc780] drop a frame at curr_cts: 2048 @ 1 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fe734dcc780] skip 962 audio samples from curr_cts: 4096 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fe734dcc780] Before avformat_find_stream_info() pos: 125571 bytes read:146819 seeks:0 nb_streams:1 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fe734dcc780] demuxer injecting skip 5058 / discard 0 [aac @ 0x7fe7341b5180] skip 10116 / discard 0 samples due to side data [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fe734dcc780] All info found [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fe734dcc780] After avformat_find_stream_info() pos: 125942 bytes read:146819 seeks:0 frames:1 [concat @ 0x7fe73522c180] Before avformat_find_stream_info() pos: 110 bytes read:110 seeks:0 nb_streams:1 [concat @ 0x7fe73522c180] file:0 stream:0 pts:-5058 pts_time:-0.114694 dts:-5058 dts_time:-0.114694 -> pts:-5058 pts_time:-0.114694 dts:-5058 dts_time:-0.114694 [aac @ 0x7fe734d32180] skip 10116 / discard 0 samples due to side data [concat @ 0x7fe73522c180] All info found [concat @ 0x7fe73522c180] After avformat_find_stream_info() pos: 110 bytes read:110 seeks:0 frames:1 /metadata/streams/kv529xxl/files.txt: could not seek to position 277.885 Input #0, concat, from '/metadata/streams/kv529xxl/files.txt': Duration: 00:21:56.60, start: -0.114694, bitrate: N/A Stream #0:0(und), 1, 1/44100: Audio: aac (HE-AAC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 64 kb/s Metadata: handler_name : SoundHandler Successfully opened the file. ``` If I only stream a specific audio file, the `-ss` works. But with `concat`, it does not. > I can send you my audio files that can reproduce this if you give me an e-mail addr or some place else.
Author
Owner

@advplyr commented on GitHub (Oct 24, 2021):

That would make sense. You can email me advplyr@protonmail.com

@advplyr commented on GitHub (Oct 24, 2021): That would make sense. You can email me advplyr@protonmail.com
Author
Owner

@svdztn commented on GitHub (Oct 24, 2021):

Thanks, sended.

@svdztn commented on GitHub (Oct 24, 2021): Thanks, sended.
Author
Owner

@advplyr commented on GitHub (Oct 24, 2021):

The first 3 packets of the audio files have negative timestamp

{
    "pts": -7106,
    "pts_time": "-0.161134",
    "dts": -7106,
    "dts_time": "-0.161134"
},
{
    "pts": -5058,
    "pts_time": "-0.114694",
    "dts": -5058,
    "dts_time": "-0.114694"
},
{
    "pts": -3010,
    "pts_time": "-0.068254",
    "dts": -3010,
    "dts_time": "-0.068254"
},

I found an ffmpeg option:

-seek_timestamp (input)
This option enables or disables seeking by timestamp in input files with the -ss option. It is disabled by default. If enabled, the argument to the -ss option is considered an actual timestamp, and is not offset by the start time of the file. This matters only for files which do not start from timestamp 0, such as transport streams.

Enabling this works, but there was one more thing I had to adjust that was messing things up.

The -ss was using start times like 29.92384 which was sometimes just ignoring the -ss, so I changed the start times to look like this 29.9s.

Both of those things together had it working consistently, that is what made it so tricky to figure out. I don't fully understand seek_timestamp yet, hopefully it is not the same as just output seeking, but we will see.

I pushed the patch, let me know if that is working for you now.

@advplyr commented on GitHub (Oct 24, 2021): The first 3 packets of the audio files have negative timestamp ```json { "pts": -7106, "pts_time": "-0.161134", "dts": -7106, "dts_time": "-0.161134" }, { "pts": -5058, "pts_time": "-0.114694", "dts": -5058, "dts_time": "-0.114694" }, { "pts": -3010, "pts_time": "-0.068254", "dts": -3010, "dts_time": "-0.068254" }, ``` I found an ffmpeg option: ``` -seek_timestamp (input) This option enables or disables seeking by timestamp in input files with the -ss option. It is disabled by default. If enabled, the argument to the -ss option is considered an actual timestamp, and is not offset by the start time of the file. This matters only for files which do not start from timestamp 0, such as transport streams. ``` Enabling this works, but there was one more thing I had to adjust that was messing things up. The `-ss` was using start times like `29.92384` which was sometimes just ignoring the `-ss`, so I changed the start times to look like this `29.9s`. Both of those things together had it working consistently, that is what made it so tricky to figure out. I don't fully understand `seek_timestamp` yet, hopefully it is not the same as just output seeking, but we will see. I pushed the patch, let me know if that is working for you now.
Author
Owner

@svdztn commented on GitHub (Oct 24, 2021):

Yes, I tested, it works perfectly now.
seek_timestamp is an input option, it should work at input progress, we can watch it by -loglevel debug or trace.

Great job !!!

@svdztn commented on GitHub (Oct 24, 2021): Yes, I tested, it works perfectly now. `seek_timestamp` is an input option, it should work at input progress, we can watch it by `-loglevel debug` or `trace`. Great job !!!
Author
Owner

@advplyr commented on GitHub (Oct 24, 2021):

Nice challenge! Now for that android download permissions error...

@advplyr commented on GitHub (Oct 24, 2021): Nice challenge! Now for that android download permissions error...
Author
Owner

@advplyr commented on GitHub (Oct 24, 2021):

Oh you mentioned in your initial post:

Another similar problem, if I add some new audio files to a book that already exists, and rescan.
Sometimes the file playing order is different from the list.

This bug still exists, but is a separate issue.

@advplyr commented on GitHub (Oct 24, 2021): Oh you mentioned in your initial post: ``` Another similar problem, if I add some new audio files to a book that already exists, and rescan. Sometimes the file playing order is different from the list. ``` This bug still exists, but is a separate issue.
Author
Owner

@svdztn commented on GitHub (Oct 24, 2021):

Oh you mentioned in your initial post:

Another similar problem, if I add some new audio files to a book that already exists, and rescan.
Sometimes the file playing order is different from the list.

This bug still exists, but is a separate issue.

Have you found any clue yet?

@svdztn commented on GitHub (Oct 24, 2021): > Oh you mentioned in your initial post: > > ``` > Another similar problem, if I add some new audio files to a book that already exists, and rescan. > Sometimes the file playing order is different from the list. > ``` > > This bug still exists, but is a separate issue. Have you found any clue yet?
Author
Owner

@advplyr commented on GitHub (Oct 24, 2021):

If a stream is already open then there is nothing that can be done, because the stream is already transcoded. The audio track scanner is not great at ordering audio files yet, I made some improvements yesterday though.

@advplyr commented on GitHub (Oct 24, 2021): If a stream is already open then there is nothing that can be done, because the stream is already transcoded. The audio track scanner is not great at ordering audio files yet, I made some improvements yesterday though.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#60