Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audio shift using LWLibavAudioCodec #72

Open
radpopl opened this issue Sep 13, 2024 · 6 comments
Open

Audio shift using LWLibavAudioCodec #72

radpopl opened this issue Sep 13, 2024 · 6 comments

Comments

@radpopl
Copy link

radpopl commented Sep 13, 2024

I have an audio problem with a 4h MP4 file (H265 VFR + AAC) from a standalone recorder.

I open it in MPC-HC and at 4:00:59.500 I have synchronized video and audio. It looks and sounds OK. VLC too.

I open it in AviSynth using LWLibavVideoCodec:

name1="VFR.mp4"
a=AudioDub(LWLibavVideoSource(name1,fpsnum=50),LWLibavAudioSource(name1))
return a

And here is the problem, because the audio track is sped up and what was in 4:00:59.500 moves to approx. 4:00:49.180
In ffms2 it is the same.

(This is not a linear shift, because at time 0:13:00.000 I have only 1 frame of shift.)

If, however, in VirtualDub, load the same MP4 file as an audio track (Audio->Audio from another file), everything is perfectly synchronized.

@radpopl
Copy link
Author

radpopl commented Sep 15, 2024

Asd-g added a commit that referenced this issue Feb 6, 2025
At the indexing stage:
- previous and current PTS are checked for discontinuity;
- if any, the length of the discontinuity is stored to the index file as package with `POS=-1` and the relevants stats.
At the fetching audio stage:
- check if the requested audio samples are before, after or within the gap and adjust the offset for the decoding audio;
- fill the gap with silence.
@Asd-g
Copy link
Contributor

Asd-g commented Feb 6, 2025

Try the attached version. There is additional parameter fill_audio_gaps (true/false) for LWLibavAudioSource.

LSMASHSource.zip

@radpopl
Copy link
Author

radpopl commented Feb 9, 2025

No, it doesn't work though :/

Image

@radpopl
Copy link
Author

radpopl commented Feb 10, 2025

Edit: Did you also fix the 32000Hz problem? Suddenly LWLibavAudioSource started reading my DV files correctly.

@Asd-g
Copy link
Contributor

Asd-g commented Feb 12, 2025

Can you share sample of this file? This screenshot tells nothing.

Nothing fixed that's related directly to the audio frequencies.

@radpopl
Copy link
Author

radpopl commented Feb 13, 2025

https://files.fm/u/v92x7ec359 (uploading)

3 files. Everything is in the avs file. Frames 932062-end. The mp4 file is VFR.

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants