DOKK / manpages / debian 12 / libmedia-convert-perl / Media::Convert::AvSync.3pm.en
Media::Convert::AvSync(3pm) User Contributed Perl Documentation Media::Convert::AvSync(3pm)

Media::Convert::AvSync - Helper module to fix A/V synchronization issues.

  use Media::Convert::Asset;
  use Media::Convert::AvSync;
  
  my $input = Media::Convert::Asset->new(url => $input_filename);
  my $output = Media::Convert::Asset->new(url => $output_filename);
  Media::Convert::AvSync->new(input => $input, output => $output, audio_delay => 0.1)->run();

Media::Convert::AvSync is a higher-level helper module to correct audio/video synchronization issues.

It does this by instructing ffmpeg to read the input asset twice (once for audio, once for video), and to apply a time offset to the audio stream. This offset may be negative, in case audio precedes video.

Note that after A/V sync correction, the asset file will be reduced in length by twice the length of the correction value; this is because otherwise, in the case of audio preceding video, the resulting media file would end up with a snippet of audio with no video at the start, and one of video with no audio at the end (and vice versa for a correction value for video preceding audio).

The following attributes are supported by Media::Convert::AvSync:

The input asset. Must be a Media::Convert::Asset object.

The output asset. Must be a Media::Convert::Asset object.

The delay that should be applied to the audio in the input asset. Should be expressed in seconds; may be a fractional and/or negative value.

Postive values delay the audio; negative values delay the video.

2023-03-07 perl v5.36.0