Audio shift does not work anymore

Started by andi0661, November 19, 2016, 12:10:48 PM

Previous topic - Next topic

andi0661

Hello,
I have successfully used Avidemux 2.5 in the past to correct an audio shift, and that does not work anymore.

Some online recorders (BONG.TV in my case) generate such files with shifted audio, caused by an delayed first video frame. I am including the MediaInfo output of one of them, below.

I'm not sure what changed, but in the past, I used Avidemnux 2.5.5+_r7664 which was able to correct the shifting. A few weekas ago9, I used that same Avidemux version and it did not work anymore, repeatably. I then upgraded to the latest 2.5 version (2.5.6), and it did not work either. I also tried with Avidemux 2.6.14, and it did not work. I tried both the CLI with a project file to generate the output video, and saving it interactively (although not all combinations of the versions mentioned above, with these two approaches).

This is on Windows 7.

In all cases where it did not work, the audio shift was not eliminated in the output file, and the field
reported by MediaInfo as "Duration_FirstFrame" was not present (which actually makes it worse, because now the file does not even have a marker that the audio is shifted).

In all cases, the audio shift appeared corrected when playing the movie in Avidemux.

Here is the MediaInfo output of one such input file. The "Duration_FirstFrame" field says 706ms, and when setting the audio shift in Avidemux to -706ms, it appeared to be correct.

Is there anything I can do to get this working, or should this be considered a bug?


General
Complete name                            : ...
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom)
File size                                : 1.22 GiB
Duration                                 : 50mn 1s
Overall bit rate mode                    : Variable
Overall bit rate                         : 3 490 Kbps
Movie name                               : ...
Album                                    : SWR
Genre                                    : Tourismus
Encoded date                             : UTC 2015-11-30 14:09:31
Tagged date                              : UTC 2015-11-30 14:09:31
Writing application                      : BONG.TV

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L4
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 2 frames
Format settings, GOP                     : M=1, N=15
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 50mn 1s
Duration_FirstFrame                      : 706ms
Bit rate                                 : 3 142 Kbps
Maximum bit rate                         : 4 715 Kbps
Width                                    : 1 280 pixels
Height                                   : 720 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 50.000 fps
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.068
Stream size                              : 1.10 GiB (90%)
Title                                    : Video
Language                                 : German
Encoded date                             : UTC 2036-02-06 06:28:16
Tagged date                              : UTC 2015-11-30 14:10:08

Audio
ID                                       : 2
Format                                   : AAC
Format/Info                              : Advanced Audio Codec
Format profile                           : LC
Codec ID                                 : 40
Duration                                 : 50mn 0s
Bit rate mode                            : Variable
Bit rate                                 : 185 Kbps
Maximum bit rate                         : 189 Kbps
Channel(s)                               : 2 channels
Channel positions                        : Front: L R
Sampling rate                            : 48.0 KHz
Frame rate                               : 46.875 fps (1024 spf)
Compression mode                         : Lossy
Stream size                              : 66.3 MiB (5%)
Language                                 : German
Default                                  : Yes
Alternate group                          : 1
Encoded date                             : UTC 2036-02-06 06:28:16
Tagged date                              : UTC 2015-11-30 14:10:08

Other #1
ID                                       : 65536
Type                                     : Hint
Format                                   : RTP
Codec ID                                 : rtp
Duration                                 : 50mn 1s
Encoded date                             : UTC 2015-11-30 14:09:58
Tagged date                              : UTC 2015-11-30 14:10:08
Duration_FirstFrame                      : 706

Other #2
ID                                       : 65537
Type                                     : Hint
Format                                   : RTP
Codec ID                                 : rtp
Duration                                 : 50mn 0s
Encoded date                             : UTC 2015-11-30 14:10:08
Tagged date                              : UTC 2015-11-30 14:10:08
Bit rate mode                            : VBR


Here is the project file generated by Avidemux 2.5.6 that I used:


//AD  <- Needed to identify//
//--automatically built--
//--Project: ...
var app = new Avidemux();

//** Video **
// 01 videos source
app.load("....mp4");
//01 segments
app.clearSegments();
app.addSegment(0,18436,83925);
app.markerA=0;
app.markerB=83924;

//** Postproc **
app.video.setPostProc(3,3,0);

app.video.fps1000 = 50000;

//** Filters **

//** Video Codec conf **
app.video.codecPlugin("32BCB447-21C9-4210-AE9A-4FCE6C8588AE", "x264", "AQ=19", "<?xml version='1.0'?><x264Config><presetConfiguration><name>AM MP4 HD 1280x720 16x9 CRF19</name><type>user</type></presetConfiguration><x264Options><fastFirstPass>true</fastFirstPass><threads>0</threads><deterministic>true</deterministic><sliceThreading>false</sliceThreading><threadedLookahead>-1</threadedLookahead><idcLevel>-1</idcLevel><vui><sarAsInput>true</sarAsInput><sarHeight>1</sarHeight><sarWidth>1</sarWidth><overscan>undefined</overscan><videoFormat>undefined</videoFormat><fullRangeSamples>false</fullRangeSamples><colorPrimaries>undefined</colorPrimaries><transfer>undefined</transfer><colorMatrix>undefined</colorMatrix><chromaSampleLocation>0</chromaSampleLocation></vui><referenceFrames>3</referenceFrames><gopMaximumSize>500</gopMaximumSize><gopMinimumSize>50</gopMinimumSize><scenecutThreshold>40</scenecutThreshold><periodicIntraRefresh>false</periodicIntraRefresh><bFrames>3</bFrames><adaptiveBframeDecision>2</adaptiveBframeDecision><bFrameBias>0</bFrameBias><bFrameReferences>strict</bFrameReferences><loopFilter>true</loopFilter><loopFilterAlphaC0>0</loopFilterAlphaC0><loopFilterBeta>0</loopFilterBeta><cabac>true</cabac><openGop>disabled</openGop><interlaced>disabled</interlaced><constrainedIntraPrediction>false</constrainedIntraPrediction><cqmPreset>flat</cqmPreset><intra4x4Luma><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value></intra4x4Luma><intraChroma><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value></intraChroma><inter4x4Luma><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value></inter4x4Luma><interChroma><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value></interChroma><intra8x8Luma><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value></intra8x8Luma><inter8x8Luma><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value></inter8x8Luma><analyse><partitionI4x4>true</partitionI4x4><partitionI8x8>true</partitionI8x8><partitionP8x8>true</partitionP8x8><partitionP4x4>false</partitionP4x4><partitionB8x8>true</partitionB8x8><dct8x8>true</dct8x8><weightedPredictionPframes>smart</weightedPredictionPframes><weightedPrediction>true</weightedPrediction><directPredictionMode>spatial</directPredictionMode><chromaLumaQuantiserDifference>0</chromaLumaQuantiserDifference><motionEstimationMethod>multi-hexagonal</motionEstimationMethod><motionVectorSearchRange>24</motionVectorSearchRange><motionVectorLength>-1</motionVectorLength><motionVectorThreadBuffer>-1</motionVectorThreadBuffer><subpixelRefinement>9</subpixelRefinement><chromaMotionEstimation>true</chromaMotionEstimation><mixedReferences>true</mixedReferences><trellis>allModeDecisions</trellis><fastPSkip>false</fastPSkip><dctDecimate>true</dctDecimate><psychoRdo>1</psychoRdo><psychoTrellis>0</psychoTrellis><noiseReduction>0</noiseReduction><interLumaDeadzone>21</interLumaDeadzone><intraLumaDeadzone>11</intraLumaDeadzone></analyse><rateControl><quantiserMinimum>10</quantiserMinimum><quantiserMaximum>36</quantiserMaximum><quantiserStep>2</quantiserStep><maximumConstantRateFactor>0</maximumConstantRateFactor><averageBitrateTolerance>1</averageBitrateTolerance><vbvMaximumBitrate>0</vbvMaximumBitrate><vbvBufferSize>0</vbvBufferSize><vbvInitialOccupancy>0.9</vbvInitialOccupancy><ipFrameQuantiser>1.4</ipFrameQuantiser><pbFrameQuantiser>1.3</pbFrameQuantiser><adaptiveQuantiserMode>variance</adaptiveQuantiserMode><adaptiveQuantiserStrength>1</adaptiveQuantiserStrength><mbTree>true</mbTree><frametypeLookahead>50</frametypeLookahead><quantiserCurveCompression>0.6</quantiserCurveCompression><reduceFluxBeforeCurveCompression>20</reduceFluxBeforeCurveCompression><reduceFluxAfterCurveCompression>0.5</reduceFluxAfterCurveCompression></rateControl><accessUnitDelimiters>false</accessUnitDelimiters><spsIdentifier>0</spsIdentifier><sliceMaxSize>0</sliceMaxSize><sliceMaxMacroblocks>0</sliceMaxMacroblocks><sliceCount>0</sliceCount><hrd>none</hrd></x264Options></x264Config>");

//** Audio **
app.audio.reset();
app.audio.codec("Faac",192,4,"c0 00 00 00 ");
app.audio.normalizeMode=0;
app.audio.normalizeValue=0;
app.audio.delay=-706;
app.audio.mixer="NONE";
app.setContainer("MP4");
setSuccess(1);
//app.Exit();

//End of script


eumagga0x2a

Please test with the latest release 2.6.15 first (though it doesn't look like audio shift was touched in between) and if the issue persists, please provide a sample (~100MiB from the beginning of the file should be enough) cut in a binary way (not with Avidemux!).

2.5.x is dead, i.e. if something doesn't work right in 2.5.x, no effort will be made to fix it.