protyposis / AudioAlign

Audio Synchronization and Analysis Tool
GNU Affero General Public License v3.0
137 stars 16 forks source link

Moving the horizontal track bar or using the arrow buttons chrashes the application #17

Open Johndirr opened 6 months ago

Johndirr commented 6 months ago

When using the horizontal track bar or the arrow buttons to navigate through the audio display the application crashes. grafik

protyposis commented 6 months ago

This happens only with certain container formats (e.g., MKV, TS) and is related to FFmpeg seeking. The fix didn't make it into the last release due to QA issues, but will be rolled out when ready.

protyposis commented 6 months ago

Fix is out: https://github.com/protyposis/AudioAlign/releases/tag/v1.6.1

Please let me know if that resolves this issue.

Johndirr commented 5 months ago

The problem still exists in version 1.7. It happened with an MKV container. The audio inside the container is in AAC format.

protyposis commented 5 months ago

I unfortunately cannot reproduce, so this must be an issue with your specific file (there are many ways how an MKV container can be structured). Can you provide a sample file?

Johndirr commented 5 months ago

Sure. Here you go: Sample

protyposis commented 5 months ago

Thank you. Unfortunately, FFmpeg cannot precisely seek this file due to the way the audio frames are timestamped (the distance of the timestamps doesn't match the size of the frames), but AudioAlign requires frame-exact seeking.

As a quick fix, I'll force AudioAlign to generate wave proxy files for all containers that exhibit this behavior. Later, direct file access can probably be reintroduced by scanning through the file and building a seek index with corrected timestamps.

protyposis commented 5 months ago

the distance of the timestamps doesn't match the size of the frames

The reason for this is the low timescale resolution that FFmpeg uses for MKV (your sample file was encoded by FFmpeg 6.1): https://github.com/FFmpeg/FFmpeg/blob/e38092ef9395d7049f871ef4d5411eb410e283e0/libavformat/matroskaenc.c#L3430-L3431

Transcoding the container to MP4 fixes the timestamps: ffmpeg -i sample.mkv -c copy sample.mp4

Johndirr commented 5 months ago

Thank you. Unfortunately, FFmpeg cannot precisely seek this file due to the way the audio frames are timestamped (the distance of the timestamps doesn't match the size of the frames), but AudioAlign requires frame-exact seeking.

Will this be a problem when fingerprinting the file? Are the timestamps not corresponding to the actual audio frame then?

protyposis commented 5 months ago

Fingerprinting is unaffected - it doesn't use these timestamps.