namidaco / namida

A Beautiful and Feature-rich Music & Video Player with Youtube Support, Built in Flutter
Other
2.28k stars 137 forks source link

Issue with audio-video synchronisation #355

Closed Piyush1625 closed 1 month ago

Piyush1625 commented 1 month ago

Hi MSOB7YY,

First, I'd like to thank you for your work on Namida—it's been incredibly useful!

However, I've encountered an issue with video and audio synchronization. When playing videos, there seems to be a slight delay between the audio and video, which becomes more noticeable during longer playback.

Are there any specific settings that I could modify to resolve this?

Thank you in advance for your help, and I appreciate your continued work on the project!

Best regards, Piyush

VerySweetBread commented 1 month ago

It's an issue, dude, not a mail

MSOB7YY commented 1 month ago

@Piyush1625 thank u so much!

would like to mention that audio/video synchornization is managed internally using MergingMediaSource so there is 0 chance it would go wrong from our side (unless issue with caching etc, but that wont be progressive). early versions had this issue tho cuz we were using 2 different players so u sure u not using old version?

do u have an example video to check?

Piyush1625 commented 1 month ago

Thank you for your response. I appreciate your effort, but I believe there may have been a misunderstanding regarding what I was asking for. Let me clarify my request to ensure we're on the same page: I recently downloaded a song in high quality and its corresponding lyrical video (without sound) separately, intending to enjoy the audio alongside the lyrical video. However, I’m encountering an issue where the audio and video are not syncing properly. The song is shorter than the lyrical video, causing a noticeable delay between the two.

Could you please advise if there are any settings in the app that can help me adjust and sync the audio with the video? Any guidance would be greatly appreciated.

MSOB7YY commented 1 month ago

there are no options to modify audio sync. what's stopping you from downloading the audio of the lyrical video tho and use it instead of the one u already have?

Piyush1625 commented 1 month ago

The audio I downloaded is in high-quality FLAC format, but the sound quality of the lyrical video is much lower. To maintain the best listening experience, I prefer to stick with the FLAC audio instead of the lower-quality one from the lyrical video

MSOB7YY commented 1 month ago

ah i see now.. sadly exoplayer doesn't support modifying audio sync iirc, so it won't be possible to allow that.

there is another solution tho which goes by modifying the video file itself using ffmpeg

if the audio is late, u need to add delay before the video

  1. create a blank video with the delay duration of 800ms (modify 0.8)

    ffmpeg -y -i "black_image.png" -vf "loop=-1:1:0,trim=duration=0.8" "/storage/emulated/0/FFMPEG/black_video.mp4"
  2. merge both

    • create mylist.txt and put the paths
      /storage/emulated/0/FFMPEG/black_video.mp4
      lyrics_video_path.mp4
    • concat both (couldn't test this, probably needs a pc)
      ffmpeg -f concat -i "/storage/emulated/0/FFMPEG/mylist.txt" -c copy "/storage/emulated/0/FFMPEG/output.mp4"

if the audio is early, u need to trim part of the video

ffmpeg -ss 0:00:00.800 -i "lyrics_video_path.mp4" -c copy "/storage/emulated/0/FFMPEG/output.mp4"

sorry tho this might be the only way