Combing Detection

Archive of historical development discussions
Discussions / Development has moved to GitHub
Forum rules
*******************************
Please be aware we are now using GitHub for issue tracking and feature requests.
- This section of the forum is now closed to new topics.

*******************************
sdm
Bright Spark User
Posts: 194
Joined: Mon Feb 19, 2007 4:53 pm

Re: Combing Detection

Post by sdm »

Hi Dynaflash and jbrjake.

Thanks for your help. I know I'm in just a little over my head, but I'm so close I can taste it!
I downloaded the svn 1342, applied jbrjake's patch and tried to apply Dyanaflash's patch for the macos gui.

Here is the terminal output:

Code: Select all

Last login: Sat Mar 15 09:19:43 on ttys000
Macintosh:~ sheldon$ cd hb-dev
Macintosh:hb-dev sheldon$ curl http://ubiquit.us/handbrake/comb-detect-vs-pastebin.patch > comb-detect.diff
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 18684  100 18684    0     0  36671      0 --:--:-- --:--:-- --:--:-- 56885
Macintosh:hb-dev sheldon$ patch -p0 < comb-detect.diff
patching file test/test.c
patching file libhb/detelecine.c
patching file libhb/hb.c
patching file libhb/hb.h
patching file libhb/render.c
patching file libhb/deinterlace.c
patching file libhb/internal.h
patching file libhb/fifo.c
patching file libhb/scan.c
patching file libhb/common.h
Macintosh:hb-dev sheldon$ patch -p0 < /Users/sheldon/HB-dev/patchfile.diff
(Stripping trailing CRs from patch.)
patching file macosx/PictureController.mm
(Stripping trailing CRs from patch.)
patching file macosx/Controller.mm
patch unexpectedly ends in middle of line
Hunk #1 succeeded at 1631 with fuzz 1.
Macintosh:hb-dev sheldon$
If you look at the last couple of lines, it looks like the patch wasn't fully applied.
I'm sure this probably has to do with the pastebin issues jbrjake mentioned above.
This time, among other methods, I tried Firefox and clicked on the pastebin link, then the 'raw' link, then saved the page as text from firefox, then tried to apply the patch.

I suspect my problems has to do with semantics of code. ie. carriage returns, line breaks etc.

If you could make the procedure just a little more idiot-proof, that'd be great.
If not, I can't wait to see it in the gui someday.

Thanks again.
--sdm.
jbrjake
Veteran User
Posts: 4805
Joined: Wed Dec 13, 2006 1:38 am

Re: Combing Detection

Post by jbrjake »

Are you sure it didn't apply sdm? That "hunk succeeded" line is correct...

I went to the raw pastebin link, selected all, copied, pasted into a fresh textmate doc, saved, patched, and it worked fine -- without those CR errors you got. But "hunk succeeded at line 1631" is right...
sdm
Bright Spark User
Posts: 194
Joined: Mon Feb 19, 2007 4:53 pm

Re: Combing Detection

Post by sdm »

I downloaded TextMate and used it with Dynaflash's patch and what do you know? Build went smooth!
Thanks a bunch.

I used the same test file to test the selective decomb filter.
The good news is that filter seems to be doing something for sure

Code: Select all

[14:31:57] deinterlacer: filtered 42 | unfiltered 6007 | total 6049
The bad news is that unfortunately, something isn't working right on my source video.
The encoded video came out with an average fps of 11.71 fps and the sound pulsed in and out a couple of times per second... this makes the video unwatchable.

There is some pretty strange stuff in the activity log.
Perhaps you can make some sense of it:

Code: Select all

47, expected 40741457)
[14:31:32] sync: adding 197 ms of silence to audio 0  start 40093054, next 40075253
[14:31:32] sync: video time went backwards 93 ms, dropped 1 frames (frame 40782295, expected 40790705)
[14:31:33] sync: adding 110 ms of silence to audio 0  start 40117397, next 40107454
[14:31:33] sync: adding 115 ms of silence to audio 0  start 40142225, next 40131797
[14:31:33] sync: adding 122 ms of silence to audio 0  start 40167688, next 40156625
[14:31:33] sync: video time went backwards 73 ms, dropped 1 frames (frame 40829760, expected 40836407)
[14:31:33] sync: video time went backwards 81 ms, dropped 1 frames (frame 40857428, expected 40864781)
[14:31:33] sync: adding 200 ms of silence to audio 0  start 40214503, next 40196488
[14:31:33] sync: video time went backwards 94 ms, dropped 1 frames (frame 40905691, expected 40914195)
[14:31:33] sync: adding 110 ms of silence to audio 0  start 40238848, next 40228903
[14:31:33] sync: adding 116 ms of silence to audio 0  start 40263748, next 40253248
[14:31:33] sync: video time went backwards 74 ms, dropped 1 frames (frame 40953332, expected 40960052)
[14:31:33] sync: adding 123 ms of silence to audio 0  start 40289263, next 40278148
[14:31:33] sync: video time went backwards 82 ms, dropped 1 frames (frame 40981073, expected 40988468)
[14:31:33] sync: adding 200 ms of silence to audio 0  start 40336142, next 40318063
[14:31:33] sync: video time went backwards 95 ms, dropped 1 frames (frame 41029441, expected 41037996)
[14:31:33] sync: adding 111 ms of silence to audio 0  start 40360579, next 40350542
[14:31:33] sync: adding 117 ms of silence to audio 0  start 40385591, next 40374979
[14:31:33] sync: video time went backwards 75 ms, dropped 1 frames (frame 41077196, expected 41083998)
[14:31:34] sync: adding 124 ms of silence to audio 0  start 40411218, next 40399991
[14:31:34] sync: video time went backwards 83 ms, dropped 1 frames (frame 41105019, expected 41112496)
[14:31:34] sync: adding 202 ms of silence to audio 0  start 40458271, next 40440018
[14:31:34] sync: video time went backwards 63 ms, dropped 1 frames (frame 41153541, expected 41159255)
[14:31:34] sync: adding 113 ms of silence to audio 0  start 40482910, next 40472671
[14:31:34] sync: video time went backwards 76 ms, dropped 1 frames (frame 41198537, expected 41205401)
[14:31:34] sync: adding 118 ms of silence to audio 0  start 40507994, next 40497310
[14:31:34] sync: adding 125 ms of silence to audio 0  start 40533673, next 40522394
[14:31:34] sync: video time went backwards 84 ms, dropped 1 frames (frame 41226422, expected 41234001)
[14:31:34] sync: adding 204 ms of silence to audio 0  start 40580870, next 40562473
[14:31:34] sync: video time went backwards 65 ms, dropped 1 frames (frame 41275128, expected 41281024)
[14:31:34] sync: adding 113 ms of silence to audio 0  start 40605471, next 40595270
[14:31:34] sync: adding 119 ms of silence to audio 0  start 40630607, next 40619871
[14:31:34] sync: video time went backwards 77 ms, dropped 1 frames (frame 41320348, expected 41327324)
[14:31:34] sync: video time went backwards 83 ms, dropped 1 frames (frame 41348345, expected 41355856)
[14:31:34] sync: adding 126 ms of silence to audio 0  start 40656358, next 40645007
[14:31:34] sync: adding 206 ms of silence to audio 0  start 40703699, next 40685158
[14:31:35] sync: video time went backwards 65 ms, dropped 1 frames (frame 41397055, expected 41402953)
[14:31:35] sync: adding 113 ms of silence to audio 0  start 40728312, next 40718099
[14:31:35] sync: adding 120 ms of silence to audio 0  start 40753520, next 40742712
[14:31:35] sync: adding 126 ms of silence to audio 0  start 40779333, next 40767920
[14:31:35] sync: video time went backwards 78 ms, dropped 1 frames (frame 41442449, expected 41449497)
[14:31:35] sync: adding 100 ms of silence to audio 0  start 40802758, next 40793733
[14:31:35] sync: video time went backwards 85 ms, dropped 1 frames (frame 41470518, expected 41478231)
[14:31:35] sync: adding 107 ms of silence to audio 0  start 40826808, next 40817158
[14:31:35] sync: video time went backwards 66 ms, dropped 1 frames (frame 41519562, expected 41525502)
[14:31:35] sync: adding 115 ms of silence to audio 0  start 40851564, next 40841208
[14:31:35] sync: video time went backwards 78 ms, dropped 1 frames (frame 41565000, expected 41572070)
[14:31:35] sync: adding 120 ms of silence to audio 0  start 40876844, next 40865964
[14:31:35] sync: video time went backwards 87 ms, dropped 1 frames (frame 41593091, expected 41600926)
[14:31:35] sync: adding 127 ms of silence to audio 0  start 40902750, next 40891244
[14:31:35] sync: adding 101 ms of silence to audio 0  start 40926257, next 40917150
[14:31:35] sync: adding 108 ms of silence to audio 0  start 40950380, next 40940657
[14:31:35] sync: video time went backwards 66 ms, dropped 1 frames (frame 41642289, expected 41648291)
[14:31:35] sync: adding 115 ms of silence to audio 0  start 40975178, next 40964780
[14:31:35] sync: adding 121 ms of silence to audio 0  start 41000521, next 40989578
[14:31:35] sync: video time went backwards 79 ms, dropped 1 frames (frame 41687851, expected 41695003)
[14:31:36] sync: adding 128 ms of silence to audio 0  start 41026479, next 41014921
[14:31:36] sync: video time went backwards 87 ms, dropped 1 frames (frame 41716024, expected 41723881)
[14:31:36] sync: adding 101 ms of silence to audio 0  start 41050049, next 41040879
[14:31:36] sync: adding 108 ms of silence to audio 0  start 41074254, next 41064449
[14:31:36] sync: video time went backwards 68 ms, dropped 1 frames (frame 41765296, expected 41771460)
[14:31:36] sync: adding 116 ms of silence to audio 0  start 41099134, next 41088654
[14:31:36] sync: adding 122 ms of silence to audio 0  start 41124549, next 41113534
[14:31:36] sync: video time went backwards 80 ms, dropped 1 frames (frame 41811142, expected 41818376)
[14:31:36] sync: video time went backwards 88 ms, dropped 1 frames (frame 41839397, expected 41847366)
[14:31:36] sync: adding 199 ms of silence to audio 0  start 41171318, next 41153349
[14:31:36] sync: video time went backwards 67 ms, dropped 1 frames (frame 41888863, expected 41894929)
[14:31:36] sync: adding 109 ms of silence to audio 0  start 41195585, next 41185718
[14:31:36] sync: adding 117 ms of silence to audio 0  start 41220567, next 41209985
[14:31:36] sync: adding 123 ms of silence to audio 0  start 41246064, next 41234967
[14:31:36] sync: video time went backwards 81 ms, dropped 1 frames (frame 41934633, expected 41941939)
[14:31:36] sync: video time went backwards 88 ms, dropped 1 frames (frame 41962960, expected 41970891)
[14:31:36] sync: adding 202 ms of silence to audio 0  start 41293057, next 41274864
[14:31:36] sync: adding 110 ms of silence to audio 0  start 41317436, next 41307457
[14:31:36] sync: video time went backwards 69 ms, dropped 1 frames (frame 42012440, expected 42018668)
[14:31:37] sync: adding 116 ms of silence to audio 0  start 41342350, next 41331836
[14:31:37] sync: adding 124 ms of silence to audio 0  start 41367919, next 41356750
[14:31:37] sync: video time went backwards 81 ms, dropped 1 frames (frame 42058474, expected 42065852)
[14:31:37] sync: video time went backwards 89 ms, dropped 1 frames (frame 42086873, expected 42094956)
[14:31:37] sync: adding 204 ms of silence to audio 0  start 41415086, next 41396719
[14:31:37] sync: video time went backwards 62 ms, dropped 1 frames (frame 42106968, expected 42112553)
[14:31:37] sync: adding 111 ms of silence to audio 0  start 41439537, next 41429486
[14:31:37] sync: video time went backwards 70 ms, dropped 1 frames (frame 42133574, expected 42139914)
[14:31:37] sync: adding 119 ms of silence to audio 0  start 41464653, next 41453937
[14:31:37] sync: adding 125 ms of silence to audio 0  start 41490354, next 41479053
[14:31:37] sync: video time went backwards 82 ms, dropped 1 frames (frame 42179822, expected 42187252)
[14:31:37] sync: video time went backwards 90 ms, dropped 1 frames (frame 42208273, expected 42216428)
[14:31:37] sync: adding 204 ms of silence to audio 0  start 41537565, next 41519154
[14:31:37] sync: video time went backwards 63 ms, dropped 1 frames (frame 42228440, expected 42234117)
[14:31:37] sync: adding 111 ms of silence to audio 0  start 41562038, next 41551965
[14:31:37] sync: video time went backwards 70 ms, dropped 1 frames (frame 42255138, expected 42261480)
[14:31:37] sync: adding 120 ms of silence to audio 0  start 41587276, next 41576438
[14:31:37] sync: adding 125 ms of silence to audio 0  start 41613009, next 41601676
[14:31:37] sync: video time went backwards 83 ms, dropped 1 frames (frame 42301420, expected 42308932)
[14:31:37] sync: adding 100 ms of silence to audio 0  start 41636414, next 41627409
[14:31:37] sync: video time went backwards 91 ms, dropped 1 frames (frame 42329953, expected 42338160)
[14:31:38] sync: video time went backwards 63 ms, dropped 1 frames (frame 42350172, expected 42355911)
[14:31:38] sync: adding 105 ms of silence to audio 0  start 41660344, next 41650814
[14:31:38] sync: video time went backwards 71 ms, dropped 1 frames (frame 42376932, expected 42383396)
[14:31:38] sync: adding 112 ms of silence to audio 0  start 41684899, next 41674744
[14:31:38] sync: adding 120 ms of silence to audio 0  start 41710159, next 41699299
[14:31:38] sync: video time went backwards 84 ms, dropped 1 frames (frame 42423408, expected 42431002)
[14:31:38] sync: adding 126 ms of silence to audio 0  start 41735944, next 41724559
[14:31:38] sync: adding 101 ms of silence to audio 0  start 41759511, next 41750344
[14:31:38] sync: video time went backwards 92 ms, dropped 1 frames (frame 42452023, expected 42460312)
[14:31:38] sync: video time went backwards 64 ms, dropped 1 frames (frame 42472324, expected 42478155)
[14:31:38] sync: adding 107 ms of silence to audio 0  start 41783563, next 41773911
[14:31:38] sync: video time went backwards 74 ms, dropped 1 frames (frame 42499176, expected 42505842)
[14:31:38] sync: adding 113 ms of silence to audio 0  start 41808200, next 41797963
[14:31:38] sync: adding 121 ms of silence to audio 0  start 41833572, next 41822600
[14:31:38] sync: video time went backwards 85 ms, dropped 1 frames (frame 42545896, expected 42553582)
[14:31:38] sync: video time went backwards 94 ms, dropped 1 frames (frame 42574603, expected 42583125)
[14:31:38] sync: video time went backwards 65 ms, dropped 1 frames (frame 42595136, expected 42601041)
[14:31:38] sync: adding 127 ms of silence to audio 0  start 41859439, next 41847972
[14:31:38] sync: adding 100 ms of silence to audio 0  start 41882908, next 41873839
[14:31:39] sync: adding 107 ms of silence to audio 0  start 41906982, next 41897308
[14:31:39] sync: video time went backwards 72 ms, dropped 1 frames (frame 42622062, expected 42628630)
[14:31:39] sync: adding 114 ms of silence to audio 0  start 41931691, next 41921382
[14:31:39] sync: video time went backwards 85 ms, dropped 1 frames (frame 42668777, expected 42676516)
[14:31:39] sync: adding 121 ms of silence to audio 0  start 41957025, next 41946091
[14:31:39] sync: adding 127 ms of silence to audio 0  start 41982944, next 41971425
[14:31:39] sync: adding 102 ms of silence to audio 0  start 42006575, next 41997344
[14:31:39] sync: video time went backwards 93 ms, dropped 1 frames (frame 42697537, expected 42705951)
[14:31:39] sync: video time went backwards 66 ms, dropped 1 frames (frame 42717963, expected 42723919)
[14:31:39] sync: video time went backwards 73 ms, dropped 1 frames (frame 42744940, expected 42751551)
[14:31:39] sync: adding 108 ms of silence to audio 0  start 42030751, next 42020975
[14:31:39] sync: adding 115 ms of silence to audio 0  start 42055532, next 42045151
[14:31:39] sync: video time went backwards 86 ms, dropped 1 frames (frame 42791770, expected 42799581)
[14:31:39] sync: adding 123 ms of silence to audio 0  start 42081018, next 42069932
[14:31:39] sync: video time went backwards 94 ms, dropped 1 frames (frame 42820602, expected 42829098)
[14:31:39] sync: video time went backwards 66 ms, dropped 1 frames (frame 42841110, expected 42847128)
[14:31:39] sync: adding 199 ms of silence to audio 0  start 42127749, next 42109818
[14:31:40] sync: video time went backwards 74 ms, dropped 1 frames (frame 42868149, expected 42874852)
[14:31:40] sync: adding 109 ms of silence to audio 0  start 42152027, next 42142149
[14:31:40] sync: adding 115 ms of silence to audio 0  start 42176860, next 42166427
[14:31:40] sync: adding 123 ms of silence to audio 0  start 42202418, next 42191260
[14:31:40] sync: video time went backwards 87 ms, dropped 1 frames (frame 42915143, expected 42923006)
[14:31:40] sync: video time went backwards 94 ms, dropped 1 frames (frame 42944027, expected 42952565)
[14:31:40] sync: video time went backwards 67 ms, dropped 1 frames (frame 42964577, expected 42970677)
[14:31:40] sync: adding 200 ms of silence to audio 0  start 42249243, next 42231218
[14:31:40] sync: video time went backwards 75 ms, dropped 1 frames (frame 42991698, expected 42998453)
[14:31:40] sync: adding 110 ms of silence to audio 0  start 42273553, next 42263643
[14:31:40] sync: adding 116 ms of silence to audio 0  start 42298468, next 42287953
[14:31:40] sync: adding 124 ms of silence to audio 0  start 42324078, next 42312868
[14:31:40] sync: video time went backwards 88 ms, dropped 1 frames (frame 43038806, expected 43046751)
[14:31:40] sync: video time went backwards 95 ms, dropped 1 frames (frame 43067772, expected 43076382)
[14:31:40] sync: video time went backwards 68 ms, dropped 1 frames (frame 43088394, expected 43094556)
[14:31:40] sync: adding 202 ms of silence to audio 0  start 42371087, next 42352878
[14:31:40] sync: video time went backwards 78 ms, dropped 1 frames (frame 43115577, expected 43122624)
[14:31:41] sync: adding 110 ms of silence to audio 0  start 42395469, next 42385487
[14:31:41] sync: video time went backwards 88 ms, dropped 1 frames (frame 43163069, expected 43171076)
[14:31:41] sync: adding 117 ms of silence to audio 0  start 42420466, next 42409869
[14:31:41] sync: adding 125 ms of silence to audio 0  start 42446158, next 42434866
[14:31:41] sync: video time went backwards 69 ms, dropped 1 frames (frame 43209738, expected 43215982)
[14:31:41] sync: adding 205 ms of silence to audio 0  start 42493461, next 42474958
[14:31:41] sync: video time went backwards 76 ms, dropped 1 frames (frame 43237003, expected 43243932)
[14:31:41] sync: adding 111 ms of silence to audio 0  start 42517885, next 42507861
[14:31:41] sync: video time went backwards 89 ms, dropped 1 frames (frame 43284429, expected 43292508)
[14:31:41] sync: video time went backwards 69 ms, dropped 1 frames (frame 43331232, expected 43337528)
[14:31:41] sync: video time went backwards 77 ms, dropped 1 frames (frame 43358549, expected 43365550)
[14:31:42] sync: video time went backwards 90 ms, dropped 1 frames (frame 43406109, expected 43414250)
[14:31:42] sync: adding 118 ms of silence to audio 0  start 42542974, next 42532285
[14:31:42] sync: adding 128 ms of silence to audio 0  start 42568898, next 42557374
[14:31:42] sync: adding 205 ms of silence to audio 0  start 42616176, next 42597698
[14:31:42] sync: video time went backwards 70 ms, dropped 1 frames (frame 43453036, expected 43459414)
[14:31:42] sync: adding 112 ms of silence to audio 0  start 42640693, next 42630576
[14:31:42] sync: adding 119 ms of silence to audio 0  start 42665835, next 42655093
[14:31:42] sync: adding 126 ms of silence to audio 0  start 42691652, next 42680235
[14:31:42] sync: adding 206 ms of silence to audio 0  start 42739025, next 42720452
[14:31:42] sync: video time went backwards 78 ms, dropped 1 frames (frame 43480435, expected 43487518)
[14:31:42] sync: adding 113 ms of silence to audio 0  start 42763614, next 42753425
[14:31:42] sync: adding 120 ms of silence to audio 0  start 42788828, next 42778014
[14:31:42] sync: adding 127 ms of silence to audio 0  start 42814727, next 42803228
[14:31:42] sync: video time went backwards 91 ms, dropped 1 frames (frame 43528149, expected 43536372)
[14:31:42] sync: video time went backwards 71 ms, dropped 1 frames (frame 43575250, expected 43581700)
[14:31:42] sync: adding 100 ms of silence to audio 0  start 42838148, next 42829127
[14:31:42] sync: adding 107 ms of silence to audio 0  start 42862254, next 42852548
[14:31:42] sync: video time went backwards 79 ms, dropped 1 frames (frame 43602721, expected 43609856)
[14:31:43] sync: adding 114 ms of silence to audio 0  start 42886915, next 42876654
[14:31:43] sync: adding 120 ms of silence to audio 0  start 42912181, next 42901315
[14:31:43] sync: video time went backwards 92 ms, dropped 1 frames (frame 43650559, expected 43658844)
[14:31:43] sync: adding 128 ms of silence to audio 0  start 42938122, next 42926581
[14:31:43] sync: adding 101 ms of silence to audio 0  start 42961625, next 42952522
[14:31:43] sync: adding 108 ms of silence to audio 0  start 42985783, next 42976025
[14:31:43] sync: adding 114 ms of silence to audio 0  start 43010506, next 43000183
[14:31:43] sync: adding 121 ms of silence to audio 0  start 43035854, next 43024906
[14:31:43] sync: video time went backwards 73 ms, dropped 1 frames (frame 43697784, expected 43704356)
[14:31:43] sync: video time went backwards 80 ms, dropped 1 frames (frame 43725377, expected 43732634)
[14:31:43] sync: adding 129 ms of silence to audio 0  start 43061867, next 43050254
[14:31:43] sync: video time went backwards 93 ms, dropped 1 frames (frame 43773419, expected 43781806)
[14:31:43] sync: adding 101 ms of silence to audio 0  start 43085432, next 43076267
[14:31:43] sync: video time went backwards 73 ms, dropped 1 frames (frame 43820878, expected 43827492)
[14:31:43] sync: adding 111 ms of silence to audio 0  start 43109882, next 43099832
[14:31:43] sync: adding 115 ms of silence to audio 0  start 43134697, next 43124282
[14:31:43] sync: video time went backwards 80 ms, dropped 1 frames (frame 43848513, expected 43855792)
[14:31:43] sync: adding 122 ms of silence to audio 0  start 43160107, next 43149097
[14:31:44] sync: adding 198 ms of silence to audio 0  start 43206786, next 43188907
[14:31:44] sync: video time went backwards 93 ms, dropped 1 frames (frame 43896669, expected 43905118)
[14:31:44] sync: adding 110 ms of silence to audio 0  start 43231118, next 43221186
[14:31:44] sync: video time went backwards 74 ms, dropped 1 frames (frame 43944202, expected 43950868)
[14:31:44] sync: adding 116 ms of silence to audio 0  start 43255985, next 43245518
[14:31:44] sync: video time went backwards 81 ms, dropped 1 frames (frame 43971889, expected 43979250)
[14:31:44] sync: adding 123 ms of silence to audio 0  start 43281467, next 43270385
[14:31:44] sync: adding 199 ms of silence to audio 0  start 43328260, next 43310267
[14:31:44] sync: video time went backwards 94 ms, dropped 1 frames (frame 44020189, expected 44028710)
[14:31:44] sync: adding 111 ms of silence to audio 0  start 43352664, next 43342660
[14:31:44] sync: adding 116 ms of silence to audio 0  start 43377593, next 43367064
[14:31:44] sync: video time went backwards 75 ms, dropped 1 frames (frame 44067876, expected 44074634)
[14:31:44] sync: adding 123 ms of silence to audio 0  start 43403137, next 43391993
[14:31:44] sync: video time went backwards 82 ms, dropped 1 frames (frame 44095655, expected 44103108)
[14:31:44] sync: adding 201 ms of silence to audio 0  start 43450074, next 43431937
[14:31:45] sync: video time went backwards 63 ms, dropped 1 frames (frame 44144119, expected 44149809)
[14:31:45] sync: adding 112 ms of silence to audio 0  start 43474560, next 43464474
[14:31:45] sync: adding 117 ms of silence to audio 0  start 43499561, next 43488960
[14:31:45] sync: video time went backwards 75 ms, dropped 1 frames (frame 44189057, expected 44195867)
[14:31:45] sync: adding 124 ms of silence to audio 0  start 43525187, next 43513961
[14:31:45] sync: video time went backwards 83 ms, dropped 1 frames (frame 44216888, expected 44224423)
[14:31:45] sync: adding 203 ms of silence to audio 0  start 43572288, next 43553987
[14:31:45] sync: video time went backwards 65 ms, dropped 1 frames (frame 44265516, expected 44271379)
[14:31:45] sync: adding 112 ms of silence to audio 0  start 43596826, next 43586688
[14:31:45] sync: adding 118 ms of silence to audio 0  start 43621899, next 43611226
[14:31:45] sync: video time went backwards 76 ms, dropped 1 frames (frame 44310699, expected 44317622)
[14:31:45] sync: adding 125 ms of silence to audio 0  start 43647587, next 43636299
[14:31:46] sync: adding 205 ms of silence to audio 0  start 43694872, next 43676387
[14:31:46] sync: video time went backwards 85 ms, dropped 1 frames (frame 44338643, expected 44346350)
[14:31:46] sync: adding 114 ms of silence to audio 0  start 43719532, next 43709272
[14:31:46] sync: video time went backwards 64 ms, dropped 1 frames (frame 44387516, expected 44393341)
[14:31:46] sync: adding 119 ms of silence to audio 0  start 43744687, next 43733932
[14:31:46] sync: adding 126 ms of silence to audio 0  start 43770477, next 43759087
[14:31:46] sync: video time went backwards 77 ms, dropped 1 frames (frame 44432734, expected 44439699)
[14:31:46] sync: video time went backwards 85 ms, dropped 1 frames (frame 44460720, expected 44468400)
[14:31:46] sync: adding 100 ms of silence to audio 0  start 43793919, next 43784877
[14:31:46] sync: adding 106 ms of silence to audio 0  start 43817936, next 43808319
[14:31:46] sync: video time went backwards 65 ms, dropped 1 frames (frame 44509648, expected 44515545)
[14:31:46] sync: adding 114 ms of silence to audio 0  start 43842618, next 43832336
[14:31:46] sync: adding 120 ms of silence to audio 0  start 43867865, next 43857018
[14:31:46] sync: video time went backwards 78 ms, dropped 1 frames (frame 44555010, expected 44562037)
[14:31:46] sync: adding 127 ms of silence to audio 0  start 43893717, next 43882265
[14:31:47] sync: video time went backwards 86 ms, dropped 1 frames (frame 44583058, expected 44590810)
[14:31:47] sync: adding 100 ms of silence to audio 0  start 43917171, next 43908117
[14:31:47] sync: adding 107 ms of silence to audio 0  start 43941240, next 43931571
[14:31:47] sync: video time went backwards 65 ms, dropped 1 frames (frame 44632100, expected 44638039)
[14:31:47] sync: adding 115 ms of silence to audio 0  start 43966004, next 43955640
[14:31:47] sync: adding 121 ms of silence to audio 0  start 43991313, next 43980404
[14:31:47] sync: video time went backwards 78 ms, dropped 1 frames (frame 44677556, expected 44684665)
[14:31:47] sync: adding 128 ms of silence to audio 0  start 44017237, next 44005713
[14:31:47] sync: video time went backwards 86 ms, dropped 1 frames (frame 44705686, expected 44713470)
[14:31:47] sync: adding 101 ms of silence to audio 0  start 44040773, next 44031637
[14:31:47] sync: video time went backwards 66 ms, dropped 1 frames (frame 44754832, expected 44760843)
[14:31:47] sync: adding 108 ms of silence to audio 0  start 44064934, next 44055173
[14:31:47] sync: adding 116 ms of silence to audio 0  start 44089790, next 44079334
[14:31:47] sync: adding 122 ms of silence to audio 0  start 44115171, next 44104190
[14:31:47] sync: video time went backwards 79 ms, dropped 1 frames (frame 44800432, expected 44807603)
[14:31:47] sync: video time went backwards 87 ms, dropped 1 frames (frame 44828624, expected 44836470)
[14:31:48] sync: adding 199 ms of silence to audio 0  start 44161882, next 44143971
[14:31:48] sync: video time went backwards 66 ms, dropped 1 frames (frame 44877904, expected 44883897)
[14:31:48] sync: adding 109 ms of silence to audio 0  start 44186095, next 44176282
[14:31:48] sync: adding 117 ms of silence to audio 0  start 44211033, next 44200495
[14:31:48] sync: adding 122 ms of silence to audio 0  start 44236496, next 44225433
[14:31:48] sync: video time went backwards 80 ms, dropped 1 frames (frame 44923548, expected 44930791)
[14:31:48] sync: adding 201 ms of silence to audio 0  start 44283451, next 44265296
[14:31:48] sync: video time went backwards 86 ms, dropped 1 frames (frame 44951812, expected 44959630)
[14:31:48] sync: adding 110 ms of silence to audio 0  start 44307777, next 44297851
[14:31:48] sync: adding 119 ms of silence to audio 0  start 44332887, next 44322177
[14:31:48] sync: video time went backwards 68 ms, dropped 1 frames (frame 45001136, expected 45007281)
[14:31:48] hb_ts_stream_decode - eof
[14:31:48] stream: 9338 good frames, 0 errors (0%)
[14:31:48] reader: done. 1898 scr changes
[14:31:48] thread b07bb000 exited ("reader")
[14:31:48] sync: adding 123 ms of silence to audio 0  start 44358423, next 44347287
[14:31:48] sync: video time went backwards 81 ms, dropped 1 frames (frame 45047014, expected 45054329)
[14:31:48] sync: adding 202 ms of silence to audio 0  start 44405414, next 44387223
[14:31:48] sync: video time went backwards 88 ms, dropped 1 frames (frame 45075350, expected 45083330)
[14:31:48] sync: adding 110 ms of silence to audio 0  start 44429782, next 44419814
[14:31:49] sync: adding 118 ms of silence to audio 0  start 44454865, next 44444182
[14:31:49] sync: video time went backwards 69 ms, dropped 1 frames (frame 45124908, expected 45131155)
[14:31:49] sync: adding 124 ms of silence to audio 0  start 44480483, next 44469265
[14:31:49] sync: video time went backwards 82 ms, dropped 1 frames (frame 45170970, expected 45178367)
[14:31:49] sync: adding 203 ms of silence to audio 0  start 44527618, next 44509283
[14:31:49] sync: video time went backwards 90 ms, dropped 1 frames (frame 45199388, expected 45207520)
[14:31:49] sync: adding 111 ms of silence to audio 0  start 44552048, next 44542018
[14:31:49] sync: video time went backwards 62 ms, dropped 1 frames (frame 45219532, expected 45225196)
[14:31:49] sync: video time went backwards 69 ms, dropped 1 frames (frame 45246217, expected 45252516)
[14:31:49] sync: adding 119 ms of silence to audio 0  start 44577203, next 44566448
[14:31:49] sync: adding 125 ms of silence to audio 0  start 44602863, next 44591603
[14:31:49] sync: video time went backwards 82 ms, dropped 1 frames (frame 45292383, expected 45299842)
[14:31:49] sync: adding 204 ms of silence to audio 0  start 44650092, next 44631663
[14:31:49] sync: video time went backwards 90 ms, dropped 1 frames (frame 45320863, expected 45329007)
[14:31:49] sync: video time went backwards 63 ms, dropped 1 frames (frame 45341019, expected 45346705)
[14:31:49] sync: adding 112 ms of silence to audio 0  start 44674604, next 44664492
[14:31:49] sync: video time went backwards 71 ms, dropped 1 frames (frame 45367726, expected 45374147)
[14:31:49] sync: adding 119 ms of silence to audio 0  start 44699791, next 44689004
[14:31:50] sync: adding 125 ms of silence to audio 0  start 44725523, next 44714191
[14:31:50] sync: video time went backwards 83 ms, dropped 1 frames (frame 45414126, expected 45421667)
[14:31:50] sync: adding 100 ms of silence to audio 0  start 44748937, next 44739923
[14:31:50] sync: adding 106 ms of silence to audio 0  start 44772896, next 44763337
[14:31:50] sync: video time went backwards 91 ms, dropped 1 frames (frame 45442688, expected 45450924)
[14:31:50] sync: video time went backwards 64 ms, dropped 1 frames (frame 45462936, expected 45468704)
[14:31:50] sync: adding 113 ms of silence to audio 0  start 44797470, next 44787296
[14:31:50] sync: video time went backwards 73 ms, dropped 1 frames (frame 45489725, expected 45496378)
[14:31:50] sync: adding 120 ms of silence to audio 0  start 44822719, next 44811870
[14:31:50] sync: adding 126 ms of silence to audio 0  start 44848523, next 44837119
[14:31:50] sync: video time went backwards 84 ms, dropped 1 frames (frame 45536409, expected 45544032)
[14:31:50] sync: adding 206 ms of silence to audio 0  start 44895940, next 44877323
[14:31:50] sync: video time went backwards 94 ms, dropped 1 frames (frame 45565053, expected 45573551)
[14:31:50] sync: video time went backwards 64 ms, dropped 1 frames (frame 45585563, expected 45591393)
[14:31:50] sync: video time went backwards 72 ms, dropped 1 frames (frame 45612414, expected 45618949)
[14:31:50] sync: adding 113 ms of silence to audio 0  start 44920586, next 44910340
[14:31:51] sync: adding 120 ms of silence to audio 0  start 44945807, next 44934986
[14:31:51] sync: video time went backwards 85 ms, dropped 1 frames (frame 45659042, expected 45666717)
[14:31:51] sync: adding 127 ms of silence to audio 0  start 44971683, next 44960207
[14:31:51] sync: video time went backwards 93 ms, dropped 1 frames (frame 45687738, expected 45696118)
[14:31:51] sync: adding 101 ms of silence to audio 0  start 44995231, next 44986083
[14:31:51] sync: video time went backwards 65 ms, dropped 1 frames (frame 45708130, expected 45714032)
[14:31:51] sync: adding 107 ms of silence to audio 0  start 45019334, next 45009631
[14:31:51] sync: video time went backwards 73 ms, dropped 1 frames (frame 45735053, expected 45741680)
[14:31:51] sync: adding 114 ms of silence to audio 0  start 45044052, next 45033734
[14:31:51] sync: adding 122 ms of silence to audio 0  start 45069435, next 45058452
[14:31:51] sync: video time went backwards 86 ms, dropped 1 frames (frame 45781845, expected 45789592)
[14:31:51] sync: adding 128 ms of silence to audio 0  start 45095383, next 45083835
[14:31:51] sync: adding 102 ms of silence to audio 0  start 45119033, next 45109783
[14:31:51] sync: video time went backwards 94 ms, dropped 1 frames (frame 45810613, expected 45819075)
[14:31:51] sync: video time went backwards 66 ms, dropped 1 frames (frame 45831087, expected 45837061)
[14:31:51] sync: adding 108 ms of silence to audio 0  start 45143218, next 45133433
[14:31:51] sync: video time went backwards 74 ms, dropped 1 frames (frame 45858082, expected 45864771)
[14:31:52] sync: adding 115 ms of silence to audio 0  start 45168018, next 45157618
[14:31:52] sync: adding 123 ms of silence to audio 0  start 45193553, next 45182418
[14:31:52] sync: video time went backwards 86 ms, dropped 1 frames (frame 45905008, expected 45912837)
[14:31:52] sync: video time went backwards 95 ms, dropped 1 frames (frame 45933858, expected 45942413)
[14:31:52] sync: adding 199 ms of silence to audio 0  start 45240322, next 45222353
[14:31:52] sync: video time went backwards 67 ms, dropped 1 frames (frame 45954424, expected 45960472)
[14:31:52] sync: video time went backwards 75 ms, dropped 1 frames (frame 45981493, expected 45988264)
[14:31:52] sync: adding 109 ms of silence to audio 0  start 45264559, next 45254722
[14:31:52] sync: adding 116 ms of silence to audio 0  start 45289421, next 45278959
[14:31:52] sync: video time went backwards 87 ms, dropped 1 frames (frame 46028574, expected 46036456)
[14:31:52] sync: adding 123 ms of silence to audio 0  start 45314968, next 45303821
[14:31:52] sync: video time went backwards 95 ms, dropped 1 frames (frame 46057477, expected 46066074)
[14:31:52] sync: video time went backwards 67 ms, dropped 1 frames (frame 46078086, expected 46084195)
[14:31:52] sync: adding 201 ms of silence to audio 0  start 45361881, next 45343768
[14:31:52] sync: video time went backwards 74 ms, dropped 1 frames (frame 46105216, expected 46111910)
[14:31:52] sync: adding 110 ms of silence to audio 0  start 45386230, next 45376281
[14:31:53] sync: video time went backwards 88 ms, dropped 1 frames (frame 46152282, expected 46160246)
[14:31:53] sync: adding 117 ms of silence to audio 0  start 45411174, next 45400630
[14:31:53] sync: adding 124 ms of silence to audio 0  start 45436813, next 45425574
[14:31:53] sync: video time went backwards 68 ms, dropped 1 frames (frame 46198835, expected 46205006)
[14:31:53] sync: adding 204 ms of silence to audio 0  start 45484040, next 45465613
[14:31:53] sync: video time went backwards 76 ms, dropped 1 frames (frame 46226027, expected 46232883)
[14:31:53] sync: adding 111 ms of silence to audio 0  start 45508441, next 45498440
[14:31:53] sync: video time went backwards 89 ms, dropped 1 frames (frame 46273317, expected 46281333)
[14:31:53] sync: adding 118 ms of silence to audio 0  start 45533467, next 45522841
[14:31:53] sync: adding 127 ms of silence to audio 0  start 45559368, next 45547867
[14:31:53] sync: video time went backwards 70 ms, dropped 1 frames (frame 46320044, expected 46326347)
[14:31:53] sync: adding 204 ms of silence to audio 0  start 45606539, next 45588168
[14:31:53] sync: adding 111 ms of silence to audio 0  start 45631002, next 45620939
[14:31:54] sync: adding 118 ms of silence to audio 0  start 45656080, next 45645402
[14:31:54] sync: adding 126 ms of silence to audio 0  start 45681863, next 45670480
[14:31:54] sync: video time went backwards 83 ms, dropped 1 frames (frame 46369271, expected 46376764)
[14:31:54] sync: video time went backwards 90 ms, dropped 1 frames (frame 46397785, expected 46405923)
[14:31:54] sync: adding 205 ms of silence to audio 0  start 45729198, next 45710663
[14:31:54] sync: video time went backwards 63 ms, dropped 1 frames (frame 46417935, expected 46423645)
[14:31:54] sync: video time went backwards 70 ms, dropped 1 frames (frame 46444666, expected 46451021)
[14:31:54] sync: video time went backwards 84 ms, dropped 1 frames (frame 46491004, expected 46498579)
[14:31:54] sync: got 7837 frames, 8859 expected
[14:31:54] sync: adding 112 ms of silence to audio 0  start 45753733, next 45743598
[14:31:54] sync: adding 119 ms of silence to audio 0  start 45778883, next 45768133
[14:31:54] sync: adding 127 ms of silence to audio 0  start 45804748, next 45793283
[14:31:54] sync: adding 207 ms of silence to audio 0  start 45852217, next 45833548
[14:31:54] sync: adding 113 ms of silence to audio 0  start 45876824, next 45866617
[14:31:54] sync: adding 120 ms of silence to audio 0  start 45902056, next 45891224
[14:31:54] sync: adding 128 ms of silence to audio 0  start 45928013, next 45916456
[14:31:55] sync: adding 100 ms of silence to audio 0  start 45951463, next 45942413
[14:31:55] sync: adding 108 ms of silence to audio 0  start 45975637, next 45965863
[14:31:55] sync: adding 114 ms of silence to audio 0  start 46000317, next 45990037
[14:31:55] sync: adding 120 ms of silence to audio 0  start 46025602, next 46014717
[14:31:55] sync: adding 128 ms of silence to audio 0  start 46051602, next 46040002
[14:31:55] sync: adding 101 ms of silence to audio 0  start 46075114, next 46066002
[14:31:55] sync: adding 107 ms of silence to audio 0  start 46099211, next 46089514
[14:31:55] sync: adding 114 ms of silence to audio 0  start 46123953, next 46113611
[14:31:55] sync: adding 121 ms of silence to audio 0  start 46149320, next 46138353
[14:31:55] sync: adding 197 ms of silence to audio 0  start 46195853, next 46178120
[14:31:55] sync: adding 109 ms of silence to audio 0  start 46220112, next 46210253
[14:31:55] sync: adding 115 ms of silence to audio 0  start 46244916, next 46234512
[14:31:55] sync: adding 122 ms of silence to audio 0  start 46270335, next 46259316
[14:31:56] sync: adding 199 ms of silence to audio 0  start 46317122, next 46299135
[14:31:56] sync: adding 109 ms of silence to audio 0  start 46341413, next 46331522
[14:31:56] sync: adding 116 ms of silence to audio 0  start 46366309, next 46355813
[14:31:56] sync: adding 123 ms of silence to audio 0  start 46391850, next 46380709
[14:31:56] sync: adding 200 ms of silence to audio 0  start 46438721, next 46420650
[14:31:56] sync: adding 110 ms of silence to audio 0  start 46463074, next 46453121
[14:31:56] sync: adding 117 ms of silence to audio 0  start 46488052, next 46477474
[14:31:57] thread b0c4d000 exited ("AAC encoder (libfaac)")
[14:31:57] thread b0a45000 exited ("Renderer")
[14:31:57] thread b09c3000 exited ("MPEG-2 decoder (libmpeg2)")
[14:31:57] thread b0bcb000 exited ("AC3 decoder")
[14:31:57] thread b09c3000 joined ("MPEG-2 decoder (libmpeg2)")
[14:31:57] thread b0a45000 joined ("Renderer")
[14:31:57] render: lost time: 9994313 (1787 frames)
[14:31:57] render: gained time: 9994313 (5852 frames) (0 not accounted for)
[14:31:57] render: average dropped frame duration: 5592
[14:31:57] fifo_close: trashing 1 buffer(s)
[14:31:57] fifo_close: trashing 2 buffer(s)
[14:31:57] thread b0b49000 exited ("H.264/AVC encoder (libx264)")
[14:31:57] thread b0b49000 joined ("H.264/AVC encoder (libx264)")
x264 [info]: slice I:35    Avg QP:12.50  size: 35664  PSNR Mean Y:50.32 U:53.00 V:56.76 Avg:51.24 Global:50.82
x264 [info]: slice P:4832  Avg QP:13.51  size: 19041  PSNR Mean Y:47.83 U:50.59 V:53.59 Avg:48.73 Global:48.58
x264 [info]: slice B:1167  Avg QP:16.10  size: 10485  PSNR Mean Y:45.64 U:49.74 V:52.52 Avg:46.75 Global:46.66
x264 [info]: mb I  I16..4: 34.0% 47.7% 18.4%
x264 [info]: mb P  I16..4:  9.9% 20.0%  4.4%  P16..4: 35.1% 21.3%  7.9%  0.2%  0.1%    skip: 1.1%
x264 [info]: mb B  I16..4:  6.1%  6.5%  1.5%  B16..8: 44.9%  5.3%  9.5%  direct: 9.0%  skip:17.2%
[14:31:57] mux: file size, 113331203 bytes
[14:31:57] mux: track 0, 105482302 bytes, 1637.67 kbps
[14:31:57] mux: track 1, 7655041 bytes, 118.85 kbps
[14:31:57] mux: overhead, 6.65 bytes per frame
[14:31:57] thread b0941000 exited ("muxer")
x264 [info]: 8x8 transform  intra:57.0%  inter:55.2%
x264 [info]: direct mvs  spatial:99.9%  temporal:0.1%
x264 [info]: ref P  60.2% 22.9% 16.9%
x264 [info]: ref B  81.0% 19.0%
x264 [info]: SSIM Mean Y:0.9909258
x264 [info]: PSNR Mean Y:47.422 U:50.439 V:53.399 Avg:48.363 Global:48.148 kb/s:4191.68
[14:31:57] thread b0bcb000 joined ("AC3 decoder")
[14:31:57] thread b0c4d000 joined ("AAC encoder (libfaac)")
[14:31:57] thread b07bb000 joined ("reader")
[14:31:57] thread b0941000 joined ("muxer")
[14:31:57] fifo_close: trashing 0 buffer(s)
[14:31:57] fifo_close: trashing 0 buffer(s)
[14:31:57] fifo_close: trashing 0 buffer(s)
[14:31:57] fifo_close: trashing 1 buffer(s)
[14:31:57] fifo_close: trashing 1 buffer(s)
[14:31:57] fifo_close: trashing 0 buffer(s)
[14:31:57] fifo_close: trashing 0 buffer(s)
[14:31:57] fifo_close: trashing 4 buffer(s)
[14:31:57] fifo_close: trashing 63 buffer(s)
[14:31:57] deinterlacer: filtered 42 | unfiltered 6007 | total 6049
[14:31:57] Freed 38 buffers of size 512
[14:31:57] Freed 51 buffers of size 1024
[14:31:57] Freed 2048 buffers of size 2048
[14:31:57] Freed 161 buffers of size 4096
[14:31:57] Freed 46 buffers of size 8192
[14:31:57] Freed 1230 buffers of size 16384
[14:31:57] Freed 54 buffers of size 32768
[14:31:57] Freed 865 buffers of size 518400
[14:31:57] Allocated 475640064 bytes of buffers on this pass and Freed 475640064 bytes, 0 bytes leaked
[14:31:57] thread b0739000 exited ("work")
[14:31:57] thread b0739000 joined ("work")
[14:31:57] libhb: work result = 0
HandBrake: OpenScripting.framework - scripting addition /Library/ScriptingAdditions/QXPScriptingAdditions.osax declares no loadable handlers.
What do you guys think?

Thanks again,
--sdm.
jbrjake
Veteran User
Posts: 4805
Joined: Wed Dec 13, 2006 1:38 am

Re: Combing Detection

Post by jbrjake »

That stuff's from van's new sync code, which I guess still needs some debugging for weird content. What is your source?

Also, can I see the beginning of a log please? I want to verify the filters are being applied in the right order.

The average duration of those dropped frames is huge!
van
Veteran User
Posts: 417
Joined: Wed Aug 29, 2007 6:35 am

Re: Combing Detection

Post by van »

What is this transport stream from? These lines:

Code: Select all

[14:31:48] stream: 9338 good frames, 0 errors (0%)
[14:31:48] reader: done. 1898 scr changes
say that the system clock reference was changing every fourth frame (9338/1898) which would be way outside what's permitted by the mpeg standard. Up to now HB has never looked at the SCR field in mpeg packets & I suspected the STD mods would uncover a few programs that weren't setting it correctly. My first guess would be that whatever produced this stream put quasi random numbers in the SCR. That would seriously scramble the audio & video timing and explain all the "inserting silence" and "video time went backwards" errors.
sdm
Bright Spark User
Posts: 194
Joined: Mon Feb 19, 2007 4:53 pm

Re: Combing Detection

Post by sdm »

Hi van and jbrjake,

This is a long and uninteresting story with lots of twists and turns...
I warned you.

The source is mpeg2 that is dvd compliant afaik. I literally have dozens of these files.
HandBrake used to open them directly and encode fine (minus vfr and detelecine). Then maybe around HB 0.9.0 these files would cause HB to crash completely. Then, sometime later, HB would just say 'no valid title'.
So what I've been doing is opening the mpeg2s in AviDemux and saving then with a video and audio passthrough(copy) into a .ts container.
(forgive my ignorance if this was a bad idea)
HB opens and encodes these .ts files no problem, until svn 1342 with the comb detect patch.
I posted the problems I had with svn 1342 above. The activity log I posted above, while appearing incomplete, is all that there was ... I tried again today with the same results.

Today I did two more things providing interesting (to me) results.
1. I downloaded SVN 1338 and applied the comb detect patch.
I encoded the same file with great results (smooth motion, ~ntsc film fps, no combed frames to be seen, only deinterlaced 80 frames out of 7200, sound in sync etc etc.)

Here is the activity log:

Code: Select all

[11:35:54] hb_init: checking cpu count
[11:35:54] hb_init: starting libhb thread
[11:35:54] thread b00c5000 started ("libhb")
[11:36:02] macgui: trying to open video_ts folder (parent directory chosen)
[11:36:02] hb_scan: path=/Volumes/Funky Monkey/Video Temp/Music Videos To Be Added/ Needs IVTC/Soundgarden - Fell On Black Days.ts, title_index=0
[11:36:02] thread b0c4d000 started ("scan")
[11:36:02] scan: trying to open with libdvdread
GUI ERROR dialog: dvd: DVDOpen failed (/Volumes/Funky Monkey/Video Temp/Music Videos To Be Added/ Needs IVTC/Soundgarden - Fell On Black Days.ts)
[11:36:02] file is MPEG Transport Stream
[11:36:02] hb_ts_stream_find_pids - found the following PIDS
[11:36:02]     Video PIDS : 
[11:36:02]       0x44 (68)
[11:36:02]     Audio PIDS : 
[11:36:02]       0x45 (69)
[11:36:02] hb_sample_pts: pts 945945 at 5843040
[11:36:02] hb_sample_pts: pts 2861861 at 17547920
[11:36:02] hb_sample_pts: pts 4789789 at 29192828
[11:36:02] hb_sample_pts: pts 6492492 at 40847324
[11:36:02] hb_sample_pts: pts 8177177 at 52553144
[11:36:02] hb_sample_pts: pts 9960960 at 64167220
[11:36:02] hb_sample_pts: pts 11651651 at 75836944
[11:36:02] hb_sample_pts: pts 13249249 at 87506668
[11:36:02] hb_sample_pts: pts 14810810 at 99176580
[11:36:02] hb_sample_pts: pts 16417417 at 110839912
[11:36:02] hb_sample_pts: pts 18093093 at 122519600
[11:36:02] hb_sample_pts: pts 19759759 at 134230872
[11:36:02] hb_sample_pts: pts 21339339 at 145844948
[11:36:02] hb_sample_pts: pts 22978978 at 157547384
[11:36:02] hb_sample_pts: pts 24639639 at 169173116
[11:36:02] hb_sample_pts: pts 26390390 at 180834192
[11:36:02] transport stream pid 0x45 (type 0x81) is AC-3 audio id 0x80bd
[11:36:02] scan: decoding previews for title 1
[11:36:02] scan: preview 1
[11:36:02] scan: AC3, rate=48000Hz, bitrate=448000
[11:36:02] scan: preview 2
[11:36:02] scan: preview 3
[11:36:03] Interlacing detected in preview frame 2
[11:36:03] scan: preview 4
[11:36:03] scan: preview 5
[11:36:03] Interlacing detected in preview frame 4
[11:36:03] scan: preview 6
[11:36:03] Interlacing detected in preview frame 5
[11:36:03] scan: preview 7
[11:36:03] scan: preview 8
[11:36:03] scan: preview 9
[11:36:03] scan: preview 10
[11:36:03] scan: 10 previews, 720x480, 29.970 fps, autocrop = 0/2/8/10, aspect 4:3
[11:36:03] hb_stream_update_audio: id=80bd, lang=English (AC3) (2.0 ch), 3cc=eng, rate = 48000, bitrate = 448000, flags = 0x2 (2)
[11:36:03] scan: title (0) job->width:624, job->height:480
[11:36:03] thread b0c4d000 exited ("scan")
[11:36:03] thread b0c4d000 joined ("scan")
[11:36:03] libhb: scan thread found 1 valid title(s)
[11:36:24] thread b0739000 started ("work")
[11:36:24] 1 job(s) to process
[11:36:24] starting job
[11:36:24]  + device /Volumes/Funky Monkey/Video Temp/Music Videos To Be Added/ Needs IVTC/Soundgarden - Fell On Black Days.ts
[11:36:24]  + title 1, chapter(s) 1 to 1
[11:36:24]  + 720x480 -> 702x478, crop 0/2/8/10
[11:36:24]  + filters
[11:36:24]    + Detelecine (pullup) (default settings)
[11:36:24]    + Deinterlace (ffmpeg or yadif/mcdeint) (0:-1:-1:0:1)
[11:36:24]  + video frame rate: variable (detected 29.970 fps)
[11:36:24]  + video quality 0.66
[11:36:24]  + PixelRatio: 1, width:702, height: 478
[11:36:24]  + encoder x264
[11:36:24]    + x264 options: ref=3:bframes=3:subq=6:me=umh:mixed-refs=1:direct=auto:weightb=1:brdo=1:bime=1:merange=24:analyse=all:8x8dct=1:no-fast-pskip=1
[11:36:24]  + audio 160 kbps, 48000 Hz
[11:36:24]  + encoder faac
[11:36:24]    + 80bd, English (AC3) (2.0 ch)
[11:36:24]      + Requested mixdown: Stereo (HB_AMIXDOWN_STEREO)
[11:36:24]      + Actual mixdown: Stereo (HB_AMIXDOWN_STEREO)
[11:36:24] thread b07bb000 started ("reader")
[11:36:24]  + output: /Volumes/Funky Monkey/Video Temp/Movies/Soundgarden - Fell On Black Days.ts-1.m4v
[11:36:24] thread b083d000 started ("muxer")
[11:36:24] thread b08bf000 started ("MPEG-2 decoder (libmpeg2)")
GUI ERROR dialog: dvd: DVDOpen failed (/Volumes/Funky Monkey/Video Temp/Music Videos To Be Added/ Needs IVTC/Soundgarden - Fell On Black Days.ts)
[11:36:24] thread b0941000 started ("Renderer")
[11:36:24] encx264: keyint-min: 30, keyint-max: 300
[11:36:24] encx264: encoding with stored aspect 8/9
[11:36:24] encx264: Encoding at constant RF 17.340000
[11:36:24] encx264: opening libx264 (pass 0)
x264 [warning]: width or height not divisible by 16 (702x478), compression will suffer.
x264 [info]: using SAR=8/9
x264 [info]: using cpu capabilities: MMX MMXEXT SSE SSE2 Cache64 
[11:36:24] thread b09c3000 started ("H.264/AVC encoder (libx264)")
No accelerated IMDCT transform found
[11:36:24] thread b0a45000 started ("AC3 decoder")
[11:36:24] a52_syncinfo failed
[11:36:24] a52_syncinfo ok
[11:36:24] thread b0c4d000 started ("AAC encoder (libfaac)")
[11:36:24] sync: expecting 8859 video frames
[11:36:24] sync: first pts is 0
[11:36:24] Sync: Audio discontinuity (sequence: vid 221 aud 73) (pts 25210800 < 25300800 < 25390800)
[11:36:24] Sync: Audio joined Video after discontinuity at PTS 2880
[11:36:25] macgui: Using preset: music videos
[11:39:35] hb_ts_stream_decode - eof
[11:39:35] hb_stream_read - buffer after decode has zero length data
[11:39:35] reader: done
[11:39:35] thread b07bb000 exited ("reader")
[11:39:42] sync: got 9036 frames, 8859 expected
[11:39:44] thread b0c4d000 exited ("AAC encoder (libfaac)")
[11:39:44] thread b0a45000 exited ("AC3 decoder")
[11:39:44] thread b08bf000 exited ("MPEG-2 decoder (libmpeg2)")
[11:39:44] thread b08bf000 joined ("MPEG-2 decoder (libmpeg2)")
[11:39:44] thread b09c3000 exited ("H.264/AVC encoder (libx264)")
[11:39:44] thread b0941000 exited ("Renderer")
[11:39:45] thread b0941000 joined ("Renderer")
[11:39:45] render: lost time: 5453452 (1816 frames)
[11:39:45] render: gained time: 5452702 (7028 frames) (750 not accounted for)
[11:39:45] render: average dropped frame duration: 3003
[11:39:45] fifo_close: trashing 1 buffer(s)
[11:39:45] fifo_close: trashing 2 buffer(s)
[11:39:45] thread b09c3000 joined ("H.264/AVC encoder (libx264)")
[11:39:45] mux: file size, 133970480 bytes
[11:39:45] mux: track 0, 127784047 bytes, 3397.84 kbps
[11:39:45] mux: track 1, 6014928 bytes, 159.94 kbps
[11:39:45] mux: overhead, 8.05 bytes per frame
[11:39:45] thread b083d000 exited ("muxer")
x264 [info]: slice I:36    Avg QP:12.31  size: 33747  PSNR Mean Y:51.19 U:53.89 V:57.53 Avg:52.12 Global:51.63
x264 [info]: slice P:5457  Avg QP:13.37  size: 19763  PSNR Mean Y:48.15 U:50.90 V:53.85 Avg:49.05 Global:48.89
x264 [info]: slice B:1712  Avg QP:15.82  size: 10942  PSNR Mean Y:46.05 U:49.95 V:52.79 Avg:47.13 Global:47.03
x264 [info]: mb I  I16..4: 26.0% 69.2%  4.8%
x264 [info]: mb P  I16..4: 10.6% 25.6%  2.7%  P16..4: 29.1% 22.9%  8.3%  0.2%  0.1%    skip: 0.6%
x264 [info]: mb B  I16..4:  7.5%  8.3%  1.1%  B16..8: 40.1%  7.3% 11.6%  direct: 9.3%  skip:14.7%
x264 [info]: 8x8 transform  intra:64.0%  inter:62.6%
x264 [info]: direct mvs  spatial:99.9%  temporal:0.1%
x264 [info]: ref P  61.2% 22.6% 16.2%
x264 [info]: ref B  79.4% 20.6%
x264 [info]: SSIM Mean Y:0.9915111
x264 [info]: PSNR Mean Y:47.670 U:50.688 V:53.616 Avg:48.612 Global:48.380 kb/s:4252.66
[11:39:45] thread b0a45000 joined ("AC3 decoder")
[11:39:45] thread b0c4d000 joined ("AAC encoder (libfaac)")
[11:39:45] thread b07bb000 joined ("reader")
[11:39:45] thread b083d000 joined ("muxer")
[11:39:45] fifo_close: trashing 0 buffer(s)
[11:39:45] fifo_close: trashing 0 buffer(s)
[11:39:45] fifo_close: trashing 0 buffer(s)
[11:39:45] fifo_close: trashing 1 buffer(s)
[11:39:45] fifo_close: trashing 1 buffer(s)
[11:39:45] fifo_close: trashing 0 buffer(s)
[11:39:45] fifo_close: trashing 0 buffer(s)
[11:39:45] fifo_close: trashing 0 buffer(s)
[11:39:45] fifo_close: trashing 29 buffer(s)
[11:39:45] deinterlacer: filtered 80 | unfiltered 7139 | total 7219
[11:39:45] Freed 58 buffers of size 512
[11:39:45] Freed 87 buffers of size 1024
[11:39:45] Freed 2048 buffers of size 2048
[11:39:45] Freed 0 buffers of size 4096
[11:39:45] Freed 0 buffers of size 8192
[11:39:45] Freed 130 buffers of size 16384
[11:39:45] Freed 0 buffers of size 32768
[11:39:45] Freed 205 buffers of size 518400
[11:39:45] Allocated 112715008 bytes of buffers on this pass and Freed 112715008 bytes, 0 bytes leaked
[11:39:45] thread b0739000 exited ("work")
[11:39:45] thread b0739000 joined ("work")
[11:39:45] libhb: work result = 0
HandBrake: OpenScripting.framework - scripting addition /Library/ScriptingAdditions/QXPScriptingAdditions.osax declares no loadable handlers.

2. The second thing I found interesting was that both svn 1338 and 1343 (both decomb patched) could open the source mpeg2 videos, no .ts needed. BUT both didn't get the aspect ratio correct (producing 16x9 instead of 4x3 pictures).
When I encoded from the mpeg 2 using svn 1343, the resulting video was 3 seconds longer (I now see the encodes were trimmed in the past) and the average fps was different (23.96 vs 23.94). Svn 1343 produced a truncated activity log again too.

When I encoded from the mpeg 2 using svn 1338, the resulting video was the as svn 1343 (at least judged on metrics mentioned)
The activity log worked in svn 1338

Code: Select all

[13:49:50] hb_init: checking cpu count
[13:49:50] hb_init: starting libhb thread
[13:49:50] thread b00c5000 started ("libhb")
[13:49:57] macgui: trying to open video_ts folder (parent directory chosen)
[13:49:57] hb_scan: path=/Volumes/Funky Monkey/Video Temp/Music Videos To Be Added/ Needs IVTC/Soundgarden-Fell_On_Black_Days.mpg, title_index=0
[13:49:57] thread b0bcb000 started ("scan")
[13:49:57] scan: trying to open with libdvdread
GUI ERROR dialog: dvd: DVDOpen failed (/Volumes/Funky Monkey/Video Temp/Music Videos To Be Added/ Needs IVTC/Soundgarden-Fell_On_Black_Days.mpg)
[13:49:57] file is MPEG Program Stream
[13:49:57] hb_sample_pts: pts 984929 at 5709824
[13:49:57] hb_sample_pts: pts 2894837 at 17121280
[13:49:57] hb_sample_pts: pts 4831772 at 28581888
[13:49:57] hb_sample_pts: pts 6540479 at 39942144
[13:49:57] hb_sample_pts: pts 8213150 at 51355648
[13:49:57] hb_sample_pts: pts 10011947 at 62830592
[13:49:57] hb_sample_pts: pts 11687621 at 74190848
[13:49:57] hb_sample_pts: pts 13291223 at 85592064
[13:49:57] hb_sample_pts: pts 14849780 at 96999424
[13:49:57] hb_sample_pts: pts 16447376 at 108406784
[13:49:57] hb_sample_pts: pts 18135062 at 119814144
[13:49:57] hb_sample_pts: pts 19786712 at 131250176
[13:49:57] hb_sample_pts: pts 21384308 at 142637056
[13:49:57] hb_sample_pts: pts 23011934 at 154052608
[13:49:57] hb_sample_pts: pts 24678599 at 165462016
[13:49:57] hb_sample_pts: pts 26429348 at 176871424
[13:49:57] add_audio_to_title: added AC3 audio stream 0x80bd
[13:49:57] scan: decoding previews for title 1
[13:49:57] scan: preview 1
[13:49:57] scan: AC3, rate=48000Hz, bitrate=448000
[13:49:57] scan: preview 2
[13:49:57] scan: preview 3
[13:49:57] Interlacing detected in preview frame 2
[13:49:57] scan: preview 4
[13:49:57] scan: preview 5
[13:49:57] Interlacing detected in preview frame 4
[13:49:57] scan: preview 6
[13:49:57] Interlacing detected in preview frame 5
[13:49:57] scan: preview 7
[13:49:57] scan: preview 8
[13:49:57] scan: preview 9
[13:49:57] scan: preview 10
[13:49:57] scan: 10 previews, 720x480, 29.970 fps, autocrop = 0/2/8/10, aspect 16:9
[13:49:57] hb_stream_update_audio: id=80bd, lang=Unknown (AC3) (2.0 ch), 3cc=und, rate = 48000, bitrate = 448000, flags = 0x2 (2)
[13:49:57] scan: title (0) job->width:704, job->height:400
[13:49:57] thread b0bcb000 exited ("scan")
[13:49:57] thread b0bcb000 joined ("scan")
[13:49:57] libhb: scan thread found 1 valid title(s)
[13:50:10] thread b083d000 started ("work")
[13:50:10] 1 job(s) to process
[13:50:10] starting job
[13:50:10]  + device /Volumes/Funky Monkey/Video Temp/Music Videos To Be Added/ Needs IVTC/Soundgarden-Fell_On_Black_Days.mpg
[13:50:10]  + title 1, chapter(s) 1 to 1
[13:50:10]  + 720x480 -> 702x478, crop 0/2/8/10
[13:50:10]  + filters
[13:50:10]    + Detelecine (pullup) (default settings)
[13:50:10]    + Deinterlace (ffmpeg or yadif/mcdeint) (0:-1:-1:0:1)
[13:50:10]  + video frame rate: variable (detected 29.970 fps)
[13:50:10]  + video quality 0.66
[13:50:10]  + PixelRatio: 1, width:702, height: 478
[13:50:10]  + encoder x264
[13:50:10]    + x264 options: ref=3:bframes=3:subq=6:me=umh:mixed-refs=1:direct=auto:weightb=1:brdo=1:bime=1:merange=24:analyse=all:8x8dct=1:no-fast-pskip=1
[13:50:10]  + audio 160 kbps, 48000 Hz
[13:50:10]  + encoder faac
[13:50:10]    + 80bd, Unknown (AC3) (2.0 ch)
[13:50:10]      + Requested mixdown: Stereo (HB_AMIXDOWN_STEREO)
[13:50:10]      + Actual mixdown: Stereo (HB_AMIXDOWN_STEREO)
[13:50:10] thread b08bf000 started ("reader")
[13:50:10]  + output: /Volumes/Funky Monkey/Video Temp/Movies/Soundgarden-Fell_On_Black_Days.mpg-1.m4v
[13:50:10] thread b0941000 started ("muxer")
[13:50:10] thread b09c3000 started ("MPEG-2 decoder (libmpeg2)")
GUI ERROR dialog: dvd: DVDOpen failed (/Volumes/Funky Monkey/Video Temp/Music Videos To Be Added/ Needs IVTC/Soundgarden-Fell_On_Black_Days.mpg)
[13:50:10] thread b0ac7000 started ("Renderer")
[13:50:10] encx264: keyint-min: 30, keyint-max: 300
[13:50:10] encx264: encoding with stored aspect 32/27
[13:50:10] encx264: Encoding at constant RF 17.340000
[13:50:10] encx264: opening libx264 (pass 0)
x264 [warning]: width or height not divisible by 16 (702x478), compression will suffer.
x264 [info]: using SAR=32/27
x264 [info]: using cpu capabilities: MMX MMXEXT SSE SSE2 Cache64 
[13:50:10] thread b0bcb000 started ("H.264/AVC encoder (libx264)")
No accelerated IMDCT transform found
[13:50:10] thread b0c4d000 started ("AC3 decoder")
[13:50:10] thread b0ccf000 started ("AAC encoder (libfaac)")
[13:50:10] sync: expecting 8843 video frames
[13:50:10] sync: first pts is 32978
[13:50:11] macgui: Using preset: music videos
[13:53:23] reader: done
[13:53:23] thread b08bf000 exited ("reader")
[13:53:31] sync: got 9107 frames, 8843 expected
[13:53:34] thread b09c3000 exited ("MPEG-2 decoder (libmpeg2)")
[13:53:34] thread b09c3000 joined ("MPEG-2 decoder (libmpeg2)")
[13:53:34] thread b0ccf000 exited ("AAC encoder (libfaac)")
[13:53:34] thread b0c4d000 exited ("AC3 decoder")
[13:53:34] thread b0ac7000 exited ("Renderer")
[13:53:34] thread b0ac7000 joined ("Renderer")
[13:53:34] render: lost time: 5483478 (1826 frames)
[13:53:34] render: gained time: 5483478 (7069 frames) (0 not accounted for)
[13:53:34] render: average dropped frame duration: 3003
[13:53:34] fifo_close: trashing 1 buffer(s)
[13:53:34] fifo_close: trashing 2 buffer(s)
[13:53:34] thread b0bcb000 exited ("H.264/AVC encoder (libx264)")
[13:53:34] thread b0bcb000 joined ("H.264/AVC encoder (libx264)")
[13:53:34] mux: file size, 134865361 bytes
[13:53:34] mux: track 0, 128622019 bytes, 3388.65 kbps
[13:53:34] mux: track 1, 6070541 bytes, 159.93 kbps
[13:53:34] mux: overhead, 8.04 bytes per frame
[13:53:34] thread b0941000 exited ("muxer")
x264 [info]: slice I:36    Avg QP:12.31  size: 33747  PSNR Mean Y:51.19 U:53.89 V:57.53 Avg:52.12 Global:51.63
x264 [info]: slice P:5523  Avg QP:13.35  size: 19672  PSNR Mean Y:48.18 U:50.89 V:53.91 Avg:49.07 Global:48.91
x264 [info]: slice B:1718  Avg QP:15.81  size: 10926  PSNR Mean Y:46.06 U:49.95 V:52.80 Avg:47.15 Global:47.04
x264 [info]: mb I  I16..4: 26.0% 69.2%  4.8%
x264 [info]: mb P  I16..4: 10.5% 25.3%  2.6%  P16..4: 29.3% 22.9%  8.4%  0.2%  0.1%    skip: 0.6%
x264 [info]: mb B  I16..4:  7.5%  8.3%  1.1%  B16..8: 40.1%  7.3% 11.6%  direct: 9.3%  skip:14.7%
x264 [info]: 8x8 transform  intra:63.9%  inter:62.4%
x264 [info]: direct mvs  spatial:99.9%  temporal:0.1%
x264 [info]: ref P  61.1% 22.7% 16.3%
x264 [info]: ref B  79.3% 20.7%
x264 [info]: SSIM Mean Y:0.9915262
x264 [info]: PSNR Mean Y:47.695 U:50.683 V:53.664 Avg:48.634 Global:48.397 kb/s:4238.11
[13:53:34] thread b0c4d000 joined ("AC3 decoder")
[13:53:34] thread b0ccf000 joined ("AAC encoder (libfaac)")
[13:53:34] thread b08bf000 joined ("reader")
[13:53:34] thread b0941000 joined ("muxer")
[13:53:34] fifo_close: trashing 0 buffer(s)
[13:53:34] fifo_close: trashing 0 buffer(s)
[13:53:34] fifo_close: trashing 0 buffer(s)
[13:53:34] fifo_close: trashing 1 buffer(s)
[13:53:34] fifo_close: trashing 1 buffer(s)
[13:53:34] fifo_close: trashing 0 buffer(s)
[13:53:34] fifo_close: trashing 0 buffer(s)
[13:53:34] fifo_close: trashing 0 buffer(s)
[13:53:34] fifo_close: trashing 13 buffer(s)
[13:53:34] deinterlacer: filtered 80 | unfiltered 7200 | total 7280
[13:53:34] Freed 0 buffers of size 512
[13:53:34] Freed 0 buffers of size 1024
[13:53:34] Freed 2048 buffers of size 2048
[13:53:34] Freed 0 buffers of size 4096
[13:53:34] Freed 0 buffers of size 8192
[13:53:34] Freed 130 buffers of size 16384
[13:53:34] Freed 0 buffers of size 32768
[13:53:34] Freed 203 buffers of size 518400
[13:53:34] Allocated 111592192 bytes of buffers on this pass and Freed 111559424 bytes, 32768 bytes leaked
[13:53:34] thread b083d000 exited ("work")
[13:53:34] thread b083d000 joined ("work")
[13:53:34] libhb: work result = 0
HandBrake: OpenScripting.framework - scripting addition /Library/ScriptingAdditions/QXPScriptingAdditions.osax declares no loadable handlers.
To sum up:
Svn 1338 could read and encode the AviDemux .ts, but truncated 3 seconds on the encode.
Svn 1343 could open, but seriously hated the .ts. 1343's activity log wasn't working for me either
Both svns could read and encode the mpeg2 but were not getting the proper aspect ratio.

Also the comb detect seems to work! It did however mistakenly send one of my test frames to the deinterlacer (see frame 95 in screen cap above). I think this is a sensitivity issue thats really no big deal.

If you worked your way through this ... great. If you want the source I can host it on my server.

Thanks for your hard work!
--sdm.
eddyg
Veteran User
Posts: 798
Joined: Mon Apr 23, 2007 3:34 am

Re: Combing Detection

Post by eddyg »

jbrjake wrote: I've put the patch up on my 1and1 at http://ubiquit.us/handbrake/comb-detect ... ebin.patch but beware, it seems that trying to download that through Safari will mess up just like pastebin.
Right clicking on the above in Safari - Download Linked File As... then patch -p0 < comb-detect-vs-pastebin.patch worked perfectly for me:

Code: Select all

$ patch -p0 < /Users/egroenen/comb-detect-vs-pastebin.patch 
patching file test/test.c
patching file libhb/detelecine.c
patching file libhb/hb.c
patching file libhb/hb.h
patching file libhb/render.c
patching file libhb/deinterlace.c
patching file libhb/internal.h
patching file libhb/fifo.c
patching file libhb/scan.c
patching file libhb/common.h
Dynaflash's was more interesting but still worked the same way:

Code: Select all

patch -p0 < /Users/egroenen/decomb.diff.txt 
(Stripping trailing CRs from patch.)
patching file macosx/PictureController.mm
(Stripping trailing CRs from patch.)
patching file macosx/Controller.mm
patch unexpectedly ends in middle of line
Hunk #1 succeeded at 1631 with fuzz 1.
Jon - note that you've got some compiler warnings in there.

I'll have a play around with this feature, I think it's pretty exciting.

Cheers, Ed.

Cheers, Ed.
Last edited by eddyg on Mon Mar 17, 2008 9:15 pm, edited 1 time in total.
dynaflash
Veteran User
Posts: 3820
Joined: Thu Nov 02, 2006 8:19 pm

Re: Combing Detection

Post by dynaflash »

Okay, heres a log using decombing and vfr on an .eyetv file snippet (Sound Stage - Tom Petty and the Hearbreakers) that has given me issues in the past. I note that the graphics at the beginning where it show "Sound Stage" has no distortion in the text serifs like I had before. Also note the many changes between film and video that announce themselves during the encode considering the short length of the source (2:22)

http://handbrake.pastebin.ca/946372

Code: Select all

HandBrake Activity Log for Session (Cleared): 2008-03-17 12:18:54 -0500

[12:18:54] macgui: Handbrake Version: 0.9.2 (2008021900)
[12:18:54] hb_init: checking cpu count
[12:18:54] hb_init: starting libhb thread
[12:18:54] thread b01c9000 started ("libhb")
[12:19:00] macgui: trying to open video_ts folder (parent directory chosen)
[12:19:00] hb_scan: path=/Users/Joe/Desktop/SoundStage_TomPetty.mpg, title_index=0
[12:19:00] thread b088f000 started ("scan")
[12:19:00] scan: trying to open with libdvdread
GUI ERROR dialog: dvd: DVDOpen failed (/Users/Joe/Desktop/SoundStage_TomPetty.mpg)
[12:19:00] file is MPEG Program Stream
[12:19:00] hb_sample_pts: pts 553746 at 9811968
[12:19:00] hb_sample_pts: pts 1364556 at 24758272
[12:19:00] hb_sample_pts: pts 2194885 at 41697280
[12:19:00] hb_sample_pts: pts 3005695 at 57683968
[12:19:00] hb_sample_pts: pts 3769959 at 73682944
[12:19:00] hb_sample_pts: pts 4484673 at 88516608
[12:19:00] hb_sample_pts: pts 5369056 at 105846784
[12:19:00] hb_sample_pts: pts 6139326 at 120870912
[12:19:00] hb_sample_pts: pts 6987673 at 137134080
[12:19:01] hb_sample_pts: pts 7816501 at 153470976
[12:19:01] hb_sample_pts: pts 8648332 at 170250240
[12:19:01] hb_sample_pts: pts 9382566 at 185198592
[12:19:01] hb_sample_pts: pts 10178361 at 202035200
[12:19:01] hb_sample_pts: pts 10951633 at 218290176
[12:19:01] hb_sample_pts: pts 11660341 at 233256960
[12:19:01] hb_sample_pts: pts 12427608 at 249571328
[12:19:01] add_audio_to_title: added AC3 audio stream 0x80bd
[12:19:01] scan: decoding previews for title 1
[12:19:01] scan: preview 1
[12:19:02] scan: AC3, rate=48000Hz, bitrate=384000
[12:19:02] scan: preview 2
[12:19:03] scan: preview 3
[12:19:03] scan: preview 4
[12:19:03] scan: preview 5
[12:19:04] Interlacing detected in preview frame 4
[12:19:04] scan: preview 6
[12:19:04] scan: preview 7
[12:19:05] scan: preview 8
[12:19:05] scan: preview 9
[12:19:05] scan: preview 10
[12:19:05] Interlacing detected in preview frame 9
[12:19:05] scan: 10 previews, 1920x1088, 29.970 fps, autocrop = 0/0/0/0, aspect 16:9
[12:19:05] stream: audio 80bd: lang Unknown (AC3) (5.1 ch), rate 48000, bitrate 384000, flags = 0x17
[12:19:05] scan: title (0) job->width:1920, job->height:1088
[12:19:05] thread b088f000 exited ("scan")
[12:19:05] thread b088f000 joined ("scan")
[12:19:05] libhb: scan thread found 1 valid title(s)
[12:20:22] thread b0687000 started ("work")
[12:20:22] 1 job(s) to process
[12:20:22] starting job
[12:20:22]  + device /Users/Joe/Desktop/SoundStage_TomPetty.mpg
[12:20:22]  + title 1, chapter(s) 1 to 1
[12:20:22]  + 1920x1088 -> 720x400, crop 0/0/0/0
[12:20:22]  + filters
[12:20:22]    + Detelecine (pullup) (default settings)
[12:20:22]    + Deinterlace (ffmpeg or yadif/mcdeint) (0:-1:-1:0:1)
[12:20:22]  + video frame rate: variable (detected 29.970 fps)
[12:20:22]  + video bitrate 700 kbps, pass 0
[12:20:22]  + PixelRatio: 0, width:720, height: 400
[12:20:22]  + encoder x264
[12:20:22]    + x264 options: level=30:bframes=0:cabac=0:ref=1:vbv-maxrate=768:vbv-bufsize=2000:analyse=all:me=umh:subq=6:no-fast-pskip=1
[12:20:22]  + audio 160 kbps, 48000 Hz
[12:20:22]  + encoder faac
[12:20:22]    + 80bd, Unknown (AC3) (5.1 ch)
[12:20:22]      + Requested mixdown: Dolby Pro Logic II (HB_AMIXDOWN_DOLBYPLII)
[12:20:22]      + Actual mixdown: Dolby Pro Logic II (HB_AMIXDOWN_DOLBYPLII)
GUI ERROR dialog: dvd: DVDOpen failed (/Users/Joe/Desktop/SoundStage_TomPetty.mpg)
[12:20:22] reader: first SCR 3 scr_offset 13206
[12:20:22] thread b078b000 started ("reader")
[12:20:22]  + output: /Users/Joe/Desktop/SoundStage_TomPetty.m4v
[12:20:22] thread b088f000 started ("muxer")
[12:20:22] thread b0911000 started ("MPEG-2 decoder (libmpeg2)")
[12:20:22] thread b0993000 started ("Renderer")
[12:20:22] encx264: keyint-min: 30, keyint-max: 300
[12:20:22] encx264: opening libx264 (pass 0)
x264 [info]: using cpu capabilities: MMX MMXEXT SSE SSE2 SSE3 SSSE3 Cache64 
[12:20:22] thread b0aa5000 started ("H.264/AVC encoder (libx264)")
No accelerated IMDCT transform found
[12:20:22] thread b0b27000 started ("AC3 decoder")
[12:20:22] thread b0ba9000 started ("AAC encoder (libfaac)")
[12:20:22] sync: expecting 4293 video frames
[12:20:22] 0.033367s: Film -> Video
[12:20:22] sync: audio 0 time went backwards 34 ms, dropped 1 frames (frame -3126, expected 0)
[12:20:23] macgui: Using preset: Test Content
[12:20:23] About to add iPod atom
[12:21:00] 15.148467s: Video -> Film
[12:21:04] 16.883499s: Film -> Video
[12:21:10] 19.586233s: Video -> Film
[12:21:57] 38.321602s: Film -> Video
[12:22:19] 46.613232s: Video -> Film
[12:22:24] 48.665279s: Film -> Video
[12:22:25] 48.932213s: Video -> Film
[12:22:25] 49.165768s: Film -> Video
[12:22:26] 49.432701s: Video -> Film
[12:22:39] 55.538811s: Film -> Video
[12:22:39] 55.638912s: Video -> Film
[12:22:55] 62.879433s: Film -> Video
[12:23:21] 74.340935s: Video -> Film
[12:23:58] 89.722969s: Film -> Video
[12:24:00] 90.657234s: Video -> Film
[12:24:00] 90.874107s: Film -> Video
[12:24:00] 90.974213s: Video -> Film
[12:24:08] 94.577774s: Film -> Video
[12:24:08] 94.677879s: Video -> Film
[12:24:15] 97.430656s: Film -> Video
[12:24:19] 99.365936s: Video -> Film
[12:24:20] 99.766319s: Film -> Video
[12:24:28] 103.203102s: Video -> Film
[12:24:29] 103.436653s: Film -> Video
[12:24:33] 105.371933s: Video -> Film
[12:24:50] 112.946167s: Film -> Video
[12:24:51] 113.213097s: Video -> Film
[12:25:11] 122.121964s: Film -> Video
[12:25:11] 122.222069s: Video -> Film
[12:25:17] 124.457657s: Film -> Video
[12:25:19] 125.225098s: Video -> Film
[12:25:31] 130.964157s: Film -> Video
[12:25:58] reader: done. 0 scr changes
[12:25:58] thread b078b000 exited ("reader")
[12:26:05] sync: got 4081 frames, 4293 expected
[12:26:06] thread b0911000 exited ("MPEG-2 decoder (libmpeg2)")
[12:26:06] thread b0b27000 exited ("AC3 decoder")
[12:26:06] thread b0ba9000 exited ("AAC encoder (libfaac)")
[12:26:06] thread b0993000 exited ("Renderer")
[12:26:06] thread b0911000 joined ("MPEG-2 decoder (libmpeg2)")
[12:26:06] thread b0993000 joined ("Renderer")
[12:26:06] render: lost time: 1543547 (514 frames)
[12:26:06] render: gained time: 1542047 (2007 frames) (1500 not accounted for)
[12:26:06] render: average dropped frame duration: 3003
[12:26:06] fifo_close: trashing 1 buffer(s)
[12:26:06] fifo_close: trashing 2 buffer(s)
[12:26:06] thread b0aa5000 exited ("H.264/AVC encoder (libx264)")
[12:26:06] thread b0aa5000 joined ("H.264/AVC encoder (libx264)")
x264 [info]: slice I:38    Avg QP:21.89  size: 18832  PSNR Mean Y:42.63 U:44.22 V:45.46 Avg:43.19 Global:42.25
x264 [info]: slice P:3526  Avg QP:23.82  size:  2813  PSNR Mean Y:41.39 U:43.98 V:45.21 Avg:42.16 Global:40.51
x264 [info]: mb I  I16..4: 49.5%  0.0% 50.5%
x264 [info]: mb P  I16..4:  6.7%  0.0%  0.9%  P16..4: 48.8% 10.2%  1.1%  0.1%  0.0%    skip:32.2%
x264 [info]: SSIM Mean Y:0.9746582
x264 [info]: PSNR Mean Y:41.402 U:43.978 V:45.211 Avg:42.166 Global:40.523 kb/s:715.41
[12:26:06] mux: file size, 13529250 bytes
[12:26:06] mux: track 0, 10629399 bytes, 600.60 kbps
[12:26:06] mux: video bitrate error, -1759125 bytes
[12:26:06] mux: track 1, 2828702 bytes, 159.83 kbps
[12:26:06] mux: overhead, 6.98 bytes per frame
[12:26:06] thread b088f000 exited ("muxer")
[12:26:06] thread b0b27000 joined ("AC3 decoder")
[12:26:06] thread b0ba9000 joined ("AAC encoder (libfaac)")
[12:26:06] thread b078b000 joined ("reader")
[12:26:06] thread b088f000 joined ("muxer")
[12:26:06] fifo_close: trashing 0 buffer(s)
[12:26:06] fifo_close: trashing 0 buffer(s)
[12:26:06] fifo_close: trashing 0 buffer(s)
[12:26:06] fifo_close: trashing 1 buffer(s)
[12:26:06] fifo_close: trashing 1 buffer(s)
[12:26:06] fifo_close: trashing 0 buffer(s)
[12:26:06] fifo_close: trashing 0 buffer(s)
[12:26:06] fifo_close: trashing 3 buffer(s)
[12:26:06] fifo_close: trashing 13 buffer(s)
[12:26:06] deinterlacer: filtered 66 | unfiltered 3500 | total 3566
[12:26:06] Freed 1 buffers of size 512
[12:26:06] Freed 1 buffers of size 1024
[12:26:06] Freed 2048 buffers of size 2048
[12:26:06] Freed 0 buffers of size 4096
[12:26:06] Freed 0 buffers of size 8192
[12:26:06] Freed 34 buffers of size 16384
[12:26:06] Freed 0 buffers of size 32768
[12:26:06] Freed 43 buffers of size 3133440
[12:26:06] Allocated 139523584 bytes of buffers on this pass and Freed 139490816 bytes, 32768 bytes leaked
[12:26:06] thread b0687000 exited ("work")
[12:26:06] thread b0687000 joined ("work")
[12:26:06] libhb: work result = 0
jbrjake
Veteran User
Posts: 4805
Joined: Wed Dec 13, 2006 1:38 am

Re: Combing Detection

Post by jbrjake »

sdm, I can fix that over-deinterlacing you're seeing, but I'm not going to. In fact, I'm going to go the opposite route.

See, it was deinterlacing those bits because they came in a stream of frames with a length of 2. That is, not detelecined. I could expand the detection to be a little more conservative ("Ok, if any of the last 4 frames had a length of 3, detelecining is doing its thing") but then we start missing a lot of the combing that needs to be taken care of.

By "the opposite route" I mean I'm backtracking on this 3:2:3:2 watch-pullup's-data thing. I also noticed that one of the combed frames pullup left behind wasn't getting detected -- because pullup had it as part of a telecine sequence. So I'm going to only skip comb detection for progressive film frames, not detelecined frames. This will fix dynaflash's credits problem while but cause way more deinterlacing of detelecined material that doesn't need it. Oh well. Just need better comb detection, applied more precisely.
sdm
Bright Spark User
Posts: 194
Joined: Mon Feb 19, 2007 4:53 pm

Re: Combing Detection

Post by sdm »

jbrjake, that sounds good. I think deinterlacing a frame that doesn't need it, is preferable to leaving behind combed frames.
And if the filter skips comb detection only for progressive film frames, that's a far cry better than deinterlacing every frame!
Thanks for all the thought you've put into this.

--sdm.
van
Veteran User
Posts: 417
Joined: Wed Aug 29, 2007 6:35 am

Re: Combing Detection

Post by van »

sdm wrote: The source is mpeg2 that is dvd compliant afaik. I literally have dozens of these files.
HandBrake used to open them directly and encode fine (minus vfr and detelecine). Then maybe around HB 0.9.0 these files would cause HB to crash completely. Then, sometime later, HB would just say 'no valid title'.
So what I've been doing is opening the mpeg2s in AviDemux and saving then with a video and audio passthrough(copy) into a .ts container.

To sum up:
Svn 1338 could read and encode the AviDemux .ts, but truncated 3 seconds on the encode.
Svn 1343 could open, but seriously hated the .ts. 1343's activity log wasn't working for me either
Both svns could read and encode the mpeg2 but were not getting the proper aspect ratio.
Sdm pointed me at these bitstreams. There wasn't a combing detection bug but there was an AviDemux bug & 4 Handbrake bugs.

The AviDemux .ts wouldn't work because it put garbage in the stream's PCR (Program Clock Reference) field. As of the r1341 STD changes HB needs the PCR to reconstruct the stream timing. AFIK HB is the only open source tool to implement the STD so I can understand why this hasn't been an issue for AviDemux before but any standard conforming decoder will have trouble with these bitstreams. (I tried the .ts with EyeTV & it had more problems than HandBrake did.)

The aspect ratio problem with the .mpg's was due to a mistake in hb_libpeg2_decode. The video width, height, frame rate & aspect ratio all come from the MPEG Sequence header. This info is parsed & extracted by libmpeg2. HB was getting this info from libmpeg2 *except* for aspect ratio which it tried to extract itself from the elementary stream. The way it did this would only work if the sequence header were the first thing in the stream. This is usually true for DVD streams but not for other program & transport streams. So HB often didn't get an aspect ratio for these streams and used a randomly chosen "default" (which changed from 4:3 to 16:9 r1322 which is when it stopped working for sdm). But there shouldn't be a default - every frame libmpeg2 decodes has a width, height & aspect and HB shouldn't be ignoring the last. I changed hb_libmpeg2_decode to get aspect from libmpeg2 together with all the other info so now it always gets the real stream aspect.

There was a related problem with another of sdm's bitstreams (the U2 one). A sequence header is required to decode video but one sequence header covers multiple video frames. On a short video clip there may be only one sequence header at the beginning. HB does its first scan 1/11th into the stream so if there's only one header it will miss it. And since scanning randomly addresses the file it needs a sequence header for each preview so if there's only one it will not get previews 2-10. Eddyg fixed scan so it didn't give up on the file if it missed previews because of eof but it will still give up if it misses preview because of no sequence header. So I changed scan to start at zero for stream files (which often results in a black frame for the first preview but guarantees you get a preview even for a short clip) and to not give up unless it got no previews at all.

There was an unrelated bug pointed out by the same bitstream. It's the first program stream I've seen that used MPEG audio. sync.c requires that each audio stream have a rate set (so it can figure out the frame timing). stream.c was setting a (fake) rate for MPEG audio transport streams but not for program streams so this stream caused a divide by zero abort in sync. I moved the MPEG audio rate setting to scan (it's already there for every other audio stream type) so it will always get set.

A patch for the above is at http://pastebin.ca/962532. I'd rather not commit this until after the per-track audio work that saintdev & dynaflash are doing hits the tree - that stuff is way more important & I wouldn't want to do anything to slow it down. After that is in & settled I'll merge these & the PCM changes into head & ask about committing them.

BTW, in tracking through the aspect ratio stuff I realized that HB doesn't deal with the other two MPEG aspect ratios - 1:1 & 2.21:1. DVDs only allow 4:3 & 16:9 but the MPEG standard allows all four so we may start seeing the other two in program & transport streams. Should I look into supporting these or just ignore them for now?
saintdev
Enlightened
Posts: 146
Joined: Wed Dec 20, 2006 4:17 am

Re: Combing Detection

Post by saintdev »

van wrote:A patch for the above is at http://pastebin.ca/962532. I'd rather not commit this until after the per-track audio work that saintdev & dynaflash are doing hits the tree - that stuff is way more important & I wouldn't want to do anything to slow it down. After that is in & settled I'll merge these & the PCM changes into head & ask about committing them.
Personally I say go ahead and commit. That's why I use git. All I have to do is rebase, and fix any conflicts. Takes me about 5 minutes :)
This works too.
sdm
Bright Spark User
Posts: 194
Joined: Mon Feb 19, 2007 4:53 pm

Re: Combing Detection

Post by sdm »

Beautiful! - van this makes me so happy! Thank you!
Works perfectly!

I'm just waiting for the day that comb-dectect will detect this type of edit frame every time:
Image
This is from an encode with comb detect on and activity log reported

Code: Select all

[05:56:17] deinterlacer: filtered 146 | unfiltered 4663 | total 4809
jbrjake - at your convenience of course.

--sdm.
jbrjake
Veteran User
Posts: 4805
Joined: Wed Dec 13, 2006 1:38 am

Re: Combing Detection

Post by jbrjake »

I'm a little unsure what to do next.

In testing for another user's VFR issues encoding News Radio, I've found that the short-cuts I wanted to use simply aren't going to work.

There are three different situations that I'd like to handle at once:

Problem A- If comb detection is run on all frames, credits can sometimes get deinterlaced by comb detection, because the detector confuses serifed type for interlacing.

Problem B- If I prevent Problem A by skipping comb detection based on the frame lengths coming out of the deteleciner, then sometimes combing will be left in (when pullup weaves together mismatched fields)

...so as of my last post, I was thinking of avoiding that and only doing detection on non-progressive frames, but...

Problem C- If I prevent Problems B and A by only skipping comb detection on progressive frames, then sometimes combing will be left in (when titles were partially, but not totally detelecined by the studio, like News Radio)

So I think I might have to throw dynaflash's serifed credits problem to the wolves. Nasty looking credits on those rare sources that don't use sans-serif or bold fonts is probably the lesser evil, compared to combing.

I'd like to avoid that, though, so I'm playing around with different thresholds for frames depending on whether they're film or video, or including different modes -- one that runs detect on all frames, one on all video frames, and one on all sequences with 3:2 frame length patterns.

However, sdm, I think that by running the detection on all frames, (instead of skipping some like my last patches do) it should fix transitions like that snapshot in your last post.
eddyg
Veteran User
Posts: 798
Joined: Mon Apr 23, 2007 3:34 am

Re: Combing Detection

Post by eddyg »

Hi jbrjake,

I believe that you should run the comb detector on all frames, and if it is getting false positives then lets work on the comb detector and make it more reliable - rather than trying to filter when it is applied.

With the serifed fonts I'd have thought that there should be enough information in the frame to contradict the fact that this frame is interlaced.

So maybe the filter requires a metric that says that the frame is not interlaced as well as one that says that it is, and balance the two. Something to work on at a later stage maybe.

Cheers, Ed.
Nonsanity
Moderator
Posts: 46
Joined: Mon Feb 12, 2007 4:34 am

Re: Combing Detection

Post by Nonsanity »

jbrjake wrote:Problem A- If comb detection is run on all frames, credits can sometimes get deinterlaced by comb detection, because the detector confuses serifed type for interlacing.
One outstanding feature of serifed credits is that the seemingly-interlaced lines are far apart. With most normal interlacing, the affected area usually spans multiple lines.

Would it be efficient to require that the detection needs a positive on two adjacent lines in order to be qualify as an interlaced frame? If line X has a high interlacing score, but lines X-2 and x+2 don't, then consider it just a thin line and not true interlacing, and skip.

(I say this as a programmer that HAS NOT looked at the code in question. :))
jbrjake
Veteran User
Posts: 4805
Joined: Wed Dec 13, 2006 1:38 am

Re: Combing Detection

Post by jbrjake »

Nonsanity wrote:Would it be efficient to require that the detection needs a positive on two adjacent lines in order to be qualify as an interlaced frame? If line X has a high interlacing score, but lines X-2 and x+2 don't, then consider it just a thin line and not true interlacing, and skip.
The metric already takes that into consideration, to a certain degree. It works off 2 pairs of lines at a time, but the final decision is done on a full-frame basis, not just the results of a couple of lines.

It's a pretty simple algorithm, but I'm afraid of changing it too much from what Transcode had going on. Each time I've tried, I've ended up with worse results.

For each 4 lines of each plane:

Code: Select all

                /* Note if the 1st and 2nd lines are more different in
                   color than the 1st and 3rd lines are similar in color.*/
                if ( ( abs( s1 - s3 ) < color_equal ) && 
                     ( abs( s1 - s2 ) > color_diff ) )
                        ++cc_1;
    
                /* Note if the 2nd and 3rd lines are more different in
                   color than the 2nd and 4th lines are similar in color.*/
                if ( ( abs( s2 - s4 ) < color_equal ) &&
                     ( abs( s2 - s3 ) > color_diff) )
                        ++cc_2;
Then for each plane:

Code: Select all

        // compare results
        /* The final metric seems to be doing some kind of bits per pixel style calculation
           to decide whether or not enough lines showed alternating colors for the frame size. */
        cc[k] = (int)( ( cc_1 + cc_2 ) * 1000.0 / ( width * height ) );
        
        /* If the plane's cc score meets the threshold, flag it as combed. */
        flag[k] = 0;
        if ( cc[k] > threshold )
        {
            flag[k] = 1;
        }
    }
Then finally for each frame:

Code: Select all

    /* When more than one plane shows combing, tell the caller. */
    if (flag[0] || flag[1] || flag[2] )
    {
        return 1;
    }
I've been playing around with modifying that last bit, such as:

Code: Select all

    /* For progressive frames, require the luma and one chroma plane to show combing. */
    if( (buf->flags & 16) && flag[0] && (flag[1] || flag[2]) )
    {
        return 1;
    }
    
    /* For video frames, when more than one plane shows combing, tell the caller. */
    if (flag[0] || flag[1] || flag[2] )
    {
        return 1;
    }
jbrjake
Veteran User
Posts: 4805
Joined: Wed Dec 13, 2006 1:38 am

Re: Combing Detection

Post by jbrjake »

Ok, some minor updates.

It should now be less likely to detect combing on progressive material. It's flexible enough to skip deinterlacing the serifed credits at the beginning of A Night at the Museum, while it's strict enough to deinterlace the combed progressive frames in NewsRadio, left behind by a sub-par studio job detelecining it. I'm only letting it mark a progressive frame as combed if the luma and one chroma plane show combing. Interlaced/Hard-telecined frames get marked as combed if the luma or either of the chromas show combing.

http://handbrake.pastebin.ca/978672

Code: Select all

Index: libhb/deinterlace.c
===================================================================
--- libhb/deinterlace.c	(revision 1397)
+++ libhb/deinterlace.c	(working copy)
@@ -42,6 +42,14 @@
     int              yadif_parity;
     int              yadif_ready;
 
+    int              comb;
+    int              comb_detect;
+    int              color_equal;
+    int              color_diff;
+    int              threshold;
+    int              deinterlaced_frames;
+    int              passed_frames;
+
     uint8_t        * yadif_ref[4][3];
     int              yadif_ref_stride[3];
 
@@ -115,6 +123,26 @@
     }
 }
 
+static void yadif_get_ref( uint8_t ** pic, hb_filter_private_t * pv, int frm )
+{
+    int i;
+    for( i = 0; i < 3; i++ )
+    {
+        uint8_t * dst = pic[i];
+        const uint8_t * ref = pv->yadif_ref[frm][i];
+        int w = pv->width[i];
+        int ref_stride = pv->yadif_ref_stride[i];
+        
+        int y;
+        for( y = 0; y < pv->height[i]; y++ )
+        {
+            memcpy(dst, ref, w);
+            dst += w;
+            ref += ref_stride;
+        }
+    }
+}
+
 static void yadif_filter_line( uint8_t *dst,
                                uint8_t *prev,
                                uint8_t *cur,
@@ -356,6 +384,13 @@
     pv->buf_out[1] = hb_buffer_init( buf_size );
     pv->buf_settings = hb_buffer_init( 0 );
 
+    pv->deinterlaced_frames = 0;
+    pv->passed_frames = 0;
+    pv->comb_detect = 0;
+    pv->color_equal = 10;
+    pv->color_diff = 30;
+    pv->threshold = 9;
+
     pv->yadif_ready    = 0;
     pv->yadif_mode     = YADIF_MODE_DEFAULT;
     pv->yadif_parity   = YADIF_PARITY_DEFAULT;
@@ -365,11 +400,15 @@
 
     if( settings )
     {
-        sscanf( settings, "%d:%d:%d:%d",
+        sscanf( settings, "%d:%d:%d:%d:%d:%d:%d:%d",
                 &pv->yadif_mode,
                 &pv->yadif_parity,
                 &pv->mcdeint_mode,
-                &pv->mcdeint_qp );
+                &pv->mcdeint_qp,
+                &pv->comb_detect,
+                &pv->color_equal,
+                &pv->color_diff,
+                &pv->threshold );
     }
 
     /* Allocate yadif specific buffers */
@@ -451,6 +490,8 @@
         return;
     }
 
+    hb_log("deinterlacer: filtered %i | unfiltered %i | total %i", pv->deinterlaced_frames, pv->passed_frames, pv->deinterlaced_frames + pv->passed_frames);
+
     /* Cleanup frame buffers */
     if( pv->buf_out[0] )
     {
@@ -521,13 +562,31 @@
         avpicture_fill( &pv->pic_out, pv->buf_out[0]->data,
                         pix_fmt, width, height );
 
-        avpicture_deinterlace( &pv->pic_out, &pv->pic_in,
-                               pix_fmt, width, height );
+        /* Check for combing on the input frame */
+        int interlaced = pv->comb_detect ? ( hb_detect_comb(buf_in, width, height, pv->color_equal, pv->color_diff, pv->threshold)) : 1;
+        
+        if(interlaced)
+        {
+            avpicture_deinterlace( &pv->pic_out, &pv->pic_in,
+                                   pix_fmt, width, height );
 
-        hb_buffer_copy_settings( pv->buf_out[0], buf_in );
+            pv->deinterlaced_frames++;
+            hb_log("Frame %i is combed (Progressive: %s )", pv->deinterlaced_frames + pv->passed_frames, (buf_in->flags & 16) ? "Y" : "N");
+            
+            hb_buffer_copy_settings( pv->buf_out[0], buf_in );
+            *buf_out = pv->buf_out[0];            
+        }
+        else
+        {
+            /* No combing detected, pass input frame through unmolested.*/
+            
+            pv->passed_frames++;
+            
+            hb_buffer_copy_settings( pv->buf_out[0], buf_in );
+            *buf_out = buf_in;
+            
+        }
 
-        *buf_out = pv->buf_out[0];
-
         return FILTER_OK;
     }
 
@@ -545,6 +604,9 @@
     /* Store current frame in yadif cache */
     yadif_store_ref( (const uint8_t**)pv->pic_in.data, pv );
 
+    /* Note down if the input frame is combed */
+    pv->comb = (pv->comb << 1) | ( pv->comb_detect? hb_detect_comb(buf_in, width, height, pv->color_equal, pv->color_diff, pv->threshold) : 1);
+
     /* If yadif is not ready, store another ref and return FILTER_DELAY */
     if( pv->yadif_ready == 0 )
     {
@@ -560,30 +622,47 @@
         return FILTER_DELAY;
     }
 
-    /* Perform yadif and mcdeint filtering */
-    int frame;
-    for( frame = 0; frame <= (pv->yadif_mode & 1); frame++ )
+    /* yadif & mcdeint work one frame behind so if the previous frame
+     * had combing, deinterlace it otherwise just output it. */
+    if(  (pv->comb & 2 ) == 0 )
     {
-        int parity = frame ^ tff ^ 1;
+        /* previous frame not interlaced - copy cached input frame to buf_out */
+        
+        pv->passed_frames++;
+        
+        avpicture_fill( &pv->pic_out,  pv->buf_out[0]->data, pix_fmt, width, height );
+        yadif_get_ref( (uint8_t**)pv->pic_out.data, pv, 1 );
+        *buf_out = pv->buf_out[0];
+    }
+    else
+    {
+        /* Perform yadif and mcdeint filtering */
+        
+        pv->deinterlaced_frames++;
+        int frame;
+        for( frame = 0; frame <= (pv->yadif_mode & 1); frame++ )
+        {
+            int parity = frame ^ tff ^ 1;
 
-        avpicture_fill( &pv->pic_out, pv->buf_out[!(frame^1)]->data,
-                        pix_fmt, width, height );
-
-        yadif_filter( pv->pic_out.data, parity, tff, pv );
-
-        if( pv->mcdeint_mode >= 0 )
-        {
-            avpicture_fill( &pv->pic_in,  pv->buf_out[(frame^1)]->data,
+            avpicture_fill( &pv->pic_out, pv->buf_out[!(frame^1)]->data,
                             pix_fmt, width, height );
 
-            mcdeint_filter( pv->pic_in.data, pv->pic_out.data, parity, pv );
+            yadif_filter( pv->pic_out.data, parity, tff, pv );
 
-            *buf_out = pv->buf_out[ (frame^1)];
+            if( pv->mcdeint_mode >= 0 )
+            {
+                avpicture_fill( &pv->pic_in,  pv->buf_out[(frame^1)]->data,
+                                pix_fmt, width, height );
+    
+                mcdeint_filter( pv->pic_in.data, pv->pic_out.data, parity, pv );
+    
+                *buf_out = pv->buf_out[ (frame^1)];
+            }
+            else
+            {
+                *buf_out = pv->buf_out[!(frame^1)];
+            }
         }
-        else
-        {
-            *buf_out = pv->buf_out[!(frame^1)];
-        }
     }
 
     /* Copy buffered settings to output buffer settings */
Index: libhb/hb.c
===================================================================
--- libhb/hb.c	(revision 1397)
+++ libhb/hb.c	(working copy)
@@ -518,22 +518,29 @@
         flag[k] = 0;
         if ( cc[k] > threshold )
         {
+//            hb_log("Threhold %i: %i/%i | PTS: %lld (%fs)", k, cc[k], threshold, buf->start, (float)buf->start / 90000 );
             flag[k] = 1;
         }
     }
 
 #if 0
 /* Debugging info */
-//    if(flag)
+    if(flag[0] || flag[1] || flag[2])
         hb_log("flags: %i/%i/%i | cc0: %i | cc1: %i | cc2: %i", flag[0], flag[1], flag[2], cc[0], cc[1], cc[2]);
 #endif
 
-    /* When more than one plane shows combing, tell the caller. */
-    if (flag[0] || flag[1] || flag[2] )
+    /* For progressive frames, require the luma and one chroma plane to show combing. */
+    if( (buf->flags & 16) && flag[0] && ( flag[1] || flag[2] ) )
     {
         return 1;
     }
 
+    /* For video frames, when more than one plane shows combing, tell the caller. */
+    if ( !(buf->flags & 16) && (flag[0] || flag[1] || flag[2]) )
+    {
+        return 1;
+    }
+
     return 0;
 }
 
sdm
Bright Spark User
Posts: 194
Joined: Mon Feb 19, 2007 4:53 pm

Re: Combing Detection

Post by sdm »

Hey great work!
This patch detected, (and de-interlaced) all the frames that I noticed were encoded combed in my previous examples.

I did use it on another source and it didn't detect this type of combed frame:
Image
This frame and a couple similar frames come in an edit that has a cross fade through white - maybe something the detection can't detect?
Hope this can be of some use.

Again great work.

--sdm.
jbrjake
Veteran User
Posts: 4805
Joined: Wed Dec 13, 2006 1:38 am

Re: Combing Detection

Post by jbrjake »

White cross-fades like that are really difficult to fix. Black cross-fades too.

I was just playing with pullup, and sadly it seems that even using strict breaks, the detelecine filter can't pair those fields.

It's also quite difficult for the comb detection. The lines from different temporal fields during the fade are very similar, except for the brightness. They're so similar, I think they're not tripping the color difference sensor. This is when having all the decomb parameters in the deinterlacing settings is handy. I'll try to find some settings that work on it, but I can't guarantee they won't overfilter other parts of the video.
jbrjake
Veteran User
Posts: 4805
Joined: Wed Dec 13, 2006 1:38 am

Re: Combing Detection

Post by jbrjake »

Okay, these deinterlacing settings successfully decomb those transitions:

Code: Select all

--deinterlace="0:-1:-1:0:1:10:23:9"
No way to do that in the GUI at this point, just the CLI.

Translation:
"Use yadif mode 0 (its best quality mode), use default field order (top field first), don't use mcdeint, don't use a quality level with mcdeint, run comb detection, see pixels as similar if they're within 10 color values of each other, see pixels as different if they're more than 23 color values apart, only mark a plane as flagged if its metric is > 9." That's the default for comb detection with one change -- it usually says "see pixels as diferrent if they're more than 30 color values apart." By reducing the gap needed for it to detect a difference, it can see the cross-fades.

Downside: it ends up deinterlacing more frames :/

Default diff of 30:

Code: Select all

[15:11:54] deinterlacer: filtered 111 | unfiltered 10942 | total 11053
Diff of 23:

Code: Select all

[15:04:32] deinterlacer: filtered 324 | unfiltered 10729 | total 11053
So in addition to the combed frames at that cross-fade, it's also running the deinterlacer on 210 other frames that probably don't need it.

If you use 25 for the diff, it'll only deinterlace 222 frames, and it'll get rid of the most obvious combed frames from that fade -- but leave the first one, as the white fades back to an image.
sdm
Bright Spark User
Posts: 194
Joined: Mon Feb 19, 2007 4:53 pm

Re: Combing Detection

Post by sdm »

By reducing the gap needed for it to detect a difference, it can see the cross-fades.

Downside: it ends up deinterlacing more frames :/

Default diff of 30:
Code:
[15:11:54] deinterlacer: filtered 111 | unfiltered 10942 | total 11053

Diff of 23:
Code:
[15:04:32] deinterlacer: filtered 324 | unfiltered 10729 | total 11053

So in addition to the combed frames at that cross-fade, it's also running the deinterlacer on 210 other frames that probably don't need it.

If you use 25 for the diff, it'll only deinterlace 222 frames, and it'll get rid of the most obvious combed frames from that fade -- but leave the first one, as the white fades back to an image.
Deinterlacing those extra 210 frames is unfortunate for sure - I was thinking though, my only other choice is to deinterlace all 11053 frames if I don't want to see any combed frames. Thats much worse!

Actually maybe the default detection needs to be stronger ... like 23. I'm sure you have your reasons for 30, but really - leaving combed frames of any sort is undesirable right?

Maybe when its implemented in the GUI you can have threshold options like 'aggressive' (get 'em all and damn the cost to uncombed frames), and 'typical' (usually gets 'em all, rarely unnecessarily applied).
The default would be 'typical'. If typical doesn't catch everything, the user could choose aggressive. Or maybe a slider could be used?

jbrjake wrote:Okay, these deinterlacing settings successfully decomb those transitions:

Code: Select all

--deinterlace="0:-1:-1:0:1:10:23:9"
No way to do that in the GUI at this point, just the CLI.
I changed the color_diff value to 23 in your patch and am rebuilding HB so I can use the GUI. sneaky huh?
If that doesn't work, I guess its time to learn the CLI :(


Thanks again jbrjake.
--sdm.
sdm
Bright Spark User
Posts: 194
Joined: Mon Feb 19, 2007 4:53 pm

Re: Combing Detection

Post by sdm »

hi jbrjake,

I've been using/testing the comb detect patch. Seems good.
Unfortunately misses some tough to see combed frames.

Image
I did just happen to notice playing at normal speed though.
This is with the colour diff value = 23. I also tried with colour dif=20 and it caught the frame (and a lot of others it probably shouldn't have).

Again thanks for your work.

--sdm.
jbrjake
Veteran User
Posts: 4805
Joined: Wed Dec 13, 2006 1:38 am

Re: Combing Detection

Post by jbrjake »

You might as well start delving more deeply into the parameters.

You've got 3.

The one we've been playing with so far is the difference. There's also the sameness (color equal) and the sensitivity (threshold). The order in the settings string is Same:Different:Sensitivity.

Right now sameness is set pretty low -- samples only register as "the same" if their values are within 10 of each other. While they register as "different" if their values are within 30 (or in your tests now, down to 20) of each other. For any bit of the picture to be marked as interlaced (increasing the chance the whole frame will be flagged as combed), they both have to be tripped. That means the difference between the current pixel and the one 2 below has to be less than sameness setting, and the difference between the current pixel and the one directly below has to be greater than the difference setting.

We're mostly working with difference since that seems to be where the problem is: these samples don't get marked as different from the ones directly below them, because (in this case) the gray is so close to the charcoal background.

Then there's the sensitivity threshold. This one still partly mystifies me. It might be helpful in this case to lower it down from 9 to maybe 8 or 7. After the detector has gone through a whole frame buffer, it does a calculation I don't entirely understand to condense what it's found down to a single variable. And if that number ends up being greater than the threshold (9 by default) then the frame is flagged as combed. By lowering it, you're saying that fewer samples in the frame need to show combing for the whole thing to be flagged as combed.
sdm
Bright Spark User
Posts: 194
Joined: Mon Feb 19, 2007 4:53 pm

Re: Combing Detection

Post by sdm »

Great - thanks!

I'm going to experiment with these parameters.

By the way, I just came across a source video that I think is excellent for testing decomb.
A music video "Jet - Are You Going to be My Girl".
Its excellent because its really easy to see frames that had the deinterlace filter run on them (and shouldn't have), and also, without decomb we see those mismatched combed frames.
If you want to use for testing, let me know.

--sdm.
Post Reply