#264 cpb_cnt_minus1 out of range from AVC streams ?

closed
nobody
None
5
2013-01-11
2013-01-11
Kurtnoise
No

Hi,

It seems that MP4Box allows cpb_cnt_minus1 values > 31 when we mux AVC streams. According to the specs, only 0-31 range is legal. Is it really a bug ?

More informations & samples from here : http://forum.doom9.org/showthread.php?p=1610245#post1610245

Discussion

  • Romain Bouqueau

    Romain Bouqueau - 2013-01-11

    Hi Kurtnoise,

    Thanks for reporting.

    The file is definitely corrupted (I also tried with another non-free tool). I have a patch, to display a message when the value is not in range.

    Did you have access to the raw h264? We would need to check its compliance.

    Romain

     
  • Selur

    Selur - 2013-01-11

    Since I don't have the raw any more here's what I do to create these files:

    a. extract audio
    ffmpeg -y -threads 8 -i "D:\VTS_01_VOBID_003_1.VOB" -vn -t 30 -acodec copy "H:\Output\iId_2_aid_128_DELAY_-161ms_14_46_20_8610_01.ac3"

    b. run delay cut over audio (mp4box otherwise sometimes doesn't like ffmpeg extracted audio)
    delaycut -o "H:\Output\iId_2_aid_128_DELAY_-161ms_14_46_20_8610_02.ac3" -i "H:\Output\iId_2_aid_128_DELAY_-161ms_14_46_20_8610_01.ac3"

    c. run DGIndex on the source
    "G:\Hybrid\avisynthPlugins\DGIndex.exe" -om 0 -i "D:\VTS_01~1.VOB" -o "H:\Output\17421089814_46_20_8610" -hide -exit

    d. generate an Avisynth script:
    -------------------------------------------------------
    SetMemoryMax(768)
    SetMTMode(5,8)
    LoadPlugin("G:\Hybrid\avisynthPlugins\LoadDll.dll")
    LoadDll("G:\Hybrid\avisynthPlugins\libfftw3f-3.dll")
    LoadDll("G:\Hybrid\avisynthPlugins\fftw3.dll")
    LoadPlugin("G:\Hybrid\avisynthPlugins\Average.dll")
    LoadPlugin("G:\Hybrid\avisynthPlugins\TIVTC.dll")
    LoadCPlugin("G:\Hybrid\avisynthPlugins\yadif.dll")
    LoadPlugin("G:\Hybrid\avisynthPlugins\ffms2.dll")
    LoadPlugin("G:\Hybrid\avisynthPlugins\VerticalCleanerSSE2.dll")
    LoadPlugin("G:\Hybrid\avisynthPlugins\TDeint.dll")
    LoadPlugin("G:\Hybrid\avisynthPlugins\SSE2Tools.dll")
    LoadPlugin("G:\Hybrid\avisynthPlugins\RepairSSE2.dll")
    LoadPlugin("G:\Hybrid\avisynthPlugins\RemoveGrainSSE2.dll")
    LoadPlugin("G:\Hybrid\avisynthPlugins\nnedi3.dll")
    LoadPlugin("G:\Hybrid\avisynthPlugins\nnedi2.dll")
    LoadPlugin("G:\Hybrid\avisynthPlugins\nnedi.dll")
    LoadPlugin("G:\Hybrid\avisynthPlugins\mvtools2.dll")
    LoadPlugin("G:\Hybrid\avisynthPlugins\mt_masktools-26.dll")
    LoadPlugin("G:\Hybrid\avisynthPlugins\FFT3DFilter.dll")
    LoadPlugin("G:\Hybrid\avisynthPlugins\eedi3.dll")
    LoadPlugin("G:\Hybrid\avisynthPlugins\EEDI2.dll")
    LoadPlugin("G:\Hybrid\avisynthPlugins\DirectShowSource.dll")
    LoadPlugin("G:\Hybrid\avisynthPlugins\dfttest.dll")
    LoadPlugin("G:\Hybrid\avisynthPlugins\AddGrainC.dll")
    LoadPlugin("G:\Hybrid\avisynthPlugins\DGDecode.dll")
    Import("G:/Hybrid\avisynthPlugins\QTGMC-3.33.avsi")
    Import("G:/Hybrid\avisynthPlugins\Srestore.avsi")
    MPEG2Source(d2v="H:\Temp\17421089814_46_20_8610.d2v")
    SetMTMode(2)
    ConvertToYv12(interlaced=true, matrix="PC.709")
    AssumeTFF()
    QTGMC(Preset="Fast")
    srestore(frate=25,omode=6,speed=9,mode=2,thresh=16,cache=-1)
    Crop(0,0,718,480)
    Spline16Resize(704,576)
    distributor()
    return(last)
    -------------------------------------------------------

    e. feed the Avisynth script through mencoder to x264
    mencoder -endpos 30 -lavdopts threads=8 -really-quiet -of rawvideo -o - -ovc raw -noskip -vf scale,format=i420 -forcedsubsonly -nosub -nosound -mc 0 "H:\Output\encodingTempAvisynthSkript_14_46_20_8610.avs" | x264 --preset ultrafast --tune fastdecode --crf 18 --profile high --level 4.1 --sync-lookahead 15 --vbv-maxrate 62500 --vbv-bufsize 78125 --sar 16:11 --colormatrix bt470bg --fps 25 --input-res 704x576 --output "H:\Output\14_46_20_8610_05.264" -

    f. rename ac3 file:
    from frH:\Output\iId_2_aid_128_DELAY_-161ms_14_46_20_8610_02.ac3 to H:\Output\iId_2_aid_128_DELAY_-161ms_14_46_20_8610_02_DELAY_161ms.ac3
    g. multiplex audio and video using mp4box 0.5.1 rev4277 (same happens with all nightls build currently available)
    MP4Box -par 1=16:11 -add "H:\Output\14_46_20_8610_05.264"#video:fps=25:delay=161 -brand avc1 -add "H:\Output\iId_2_aid_128_DELAY_-161ms_14_46_20_8610_02_DELAY_161ms.ac3"#audio:lang= -itags tool="Hybrid 2013.01.06.1" -tmp "H:\Output" -new "H:\Output\14_46_20_8610_07.mp4"

    g. rename mp4 file:
    H:\Output\14_46_20_8610_07.mp4 ### H:\Output\sample.mp4

    uloaded the raw x264, the avisynth script, the audio and the muxed file all to my google dirve and shared it:
    https://docs.google.com/file/d/0B_WxUS1XGCPAQ3A2QlY1bk0ycXM/edit
    should be available to anyone with the link.

    ----

    Some side notes, that might be interesting or not:

    VLC 2.0.1 and all mplayer versions I could get my hands on can't playback the file
    VLC 2.0.5 no playback problem
    MPC-HC can't playback the file
    MPC-HC with LAV Filters no playback problem (that is why it took me so long to detect the problem)
    DGDecNV can't handle the file
    ffmpegsource2 can't handle the file

    Cu Selur

     
  • Selur

    Selur - 2013-01-11

    did three small test encodes and all seem to be fine.
    So from the looks of it the bug is fixed.

     
  • Romain Bouqueau

    Romain Bouqueau - 2013-01-11
    • status: open --> closed
     

Log in to post a comment.