The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

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

SYNOPSIS

  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();

DESCRIPTION

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).

ATTRIBUTES

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

input

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

output

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

audio_delay

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.