[Invalid] [SVN 2263] Incorrect Framerate

Archive of historical bug reports.
Please use the GitHub link above to report issues.
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.

*******************************
User avatar
Rodeo
HandBrake Team
Posts: 12401
Joined: Tue Mar 03, 2009 8:55 pm

Re: [Invalid] [SVN 2263] Incorrect Framerate

Post by Rodeo »

Have a look at van's post in this topic.

downinitjr
Posts: 18
Joined: Wed Oct 01, 2008 1:23 am

Re: [Invalid] [SVN 2263] Incorrect Framerate

Post by downinitjr »

Rodeo wrote:Have a look at van's post in this topic.
Yeah, I've been following along there. Funny how this was an invalid bug, yet after applying the patch van wrote, everything is back to normal.

Thanks Van!

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

Re: [Invalid] [SVN 2263] Incorrect Framerate

Post by jbrjake »

downinitjr wrote:Funny how this was an invalid bug, yet after applying the patch van wrote, everything is back to normal.
Clarify please so I can correctly interpret your snark: are you just applying the patch, or are you applying the patch as well as following van's advice to set a constant output fps?

JoeBob
Posts: 9
Joined: Sat Feb 24, 2007 8:44 am

Re: [Invalid] [SVN 2263] Incorrect Framerate

Post by JoeBob »

Rodeo wrote:Have a look at van's post in this topic.
Thanks for the redirect. I love this program and can't wait for the next final release (obviously since I'm using the SVN). I just hope it's spelled out in the final release that we need to start specifying FPS on all encodes from this point forward or we'll get funky results.

User avatar
Rodeo
HandBrake Team
Posts: 12401
Joined: Tue Mar 03, 2009 8:55 pm

Re: [Invalid] [SVN 2263] Incorrect Framerate

Post by Rodeo »

jbrjake wrote:
downinitjr wrote:Funny how this was an invalid bug, yet after applying the patch van wrote, everything is back to normal.
Clarify please so I can correctly interpret your snark: are you just applying the patch, or are you applying the patch as well as following van's advice to set a constant output fps?
I can't speak for downinitjr or JoeBob, but I noticed that van's latest framerate patch has significant influence on the output framerate, even when using VFR.

I did 4 test encodes on a 30-second sample .mov file (trimmed from an MKV source using QuickTime Pro w/Perian): two using revision 2354 (with and without b-frames) and two other encodes using revision 2354 plus van's patch (again, with and without b-frames).

Revision 2354, with b-frames

Code: Select all

HandBrake Activity Log for /Users/tim/Desktop/BigBuckBunnyTest (2354, no patch).mp4: 2009-05-02 00:10:41 +0200
Handbrake Version: svn2354 i386 (2009050201)

[00:10:41] macgui: Rip: Pending queue count is 0
[00:10:41] macgui: Rip: No pending jobs, so sending this one to doAddToQueue
[00:10:41] macgui: Rip: Going right to performNewQueueScan
[00:10:41] macgui: scanning specifically for title: 1
[00:10:41] macgui: performNewQueueScan currentQueueEncodeIndex is: 0
[00:10:41] hb_scan: path=/Volumes/LaCieDisk/excluded/Videos & Movies/Test Clips/BigBuckBunnyTest.mov, title_index=1
[00:10:41] scan: trying to open with libdvdread
[00:10:41] dvd: not a dvd - trying as a stream/file instead
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Volumes/LaCieDisk/excluded/Videos & Movies/Test Clips/BigBuckBunnyTest.mov':
  Duration: 00:00:30.08, start: 0.000000, bitrate: 2055 kb/s
    Stream #0.0(): Audio: aac, 48000 Hz, stereo, s16
    Stream #0.1(): Video: h264, yuv420p, 1920x1080, PAR 1:1 DAR 16:9, 24 tbr, 1k tbn, 2k tbc
[00:10:41] scan: decoding previews for title 1
[00:10:43] Warning: Could not read data for preview 10, skipped
[00:10:43] scan: 9 previews, 1920x1080, 23.999 fps, autocrop = 0/0/0/0, aspect 16:9, PAR 1:1
[00:10:43] scan: title (0) job->width:1936, job->height:1088
[00:10:43] libhb: scan thread found 1 valid title(s)
[00:10:43] macgui: ScanDone state received from fQueueEncodeLibhb
[00:10:43] macgui: processNewQueueEncode title list is: 1
[00:10:43] macgui: Preset: ref=2:umh:bframes=2
[00:10:43] macgui: processNewQueueEncode number of passes expected is: 1
[00:10:43] macgui: prepareJob exiting
[00:10:43] 1 job(s) to process
[00:10:43] starting job
[00:10:43] job configuration:
[00:10:43]  * source
[00:10:43]    + /Volumes/LaCieDisk/excluded/Videos & Movies/Test Clips/BigBuckBunnyTest.mov
[00:10:43]    + title 1, chapter(s) 1 to 1
[00:10:43]    + container: mov,mp4,m4a,3gp,3g2,mj2
[00:10:43]    + data rate: 2055 kbps
[00:10:43]  * destination
[00:10:43]    + /Users/tim/Desktop/BigBuckBunnyTest (2354, no patch).mp4
[00:10:43]    + container: MPEG-4 (.mp4 and .m4v)
[00:10:43]  * video track
[00:10:43]    + decoder: h264
[00:10:43]    + frame rate: same as source (around 23.999 fps)
[00:10:43]    + loose anamorphic
[00:10:43]      + storage dimensions: 1920 * 1080 -> 1024 * 576, crop 0/0/0/0
[00:10:43]      + pixel aspect ratio: 1 / 1
[00:10:43]      + display dimensions: 1024 * 576
[00:10:43]    + filter
[00:10:43]      + Decomb (default settings)
[00:10:43]    + encoder: x264
[00:10:43]      + options: ref=2:me=umh:bframes=2
[00:10:43]      + quality: 22.00 (RF)
[00:10:43]  * audio track 0
[00:10:43]    + decoder: Unknown (AAC) (track 1, id 0)
[00:10:43]    + mixdown: Stereo
[00:10:43]    + dynamic range compression: 1.000000
[00:10:43]    + encoder: faac
[00:10:43]      + bitrate: 128 kbps, samplerate: 48000 Hz
[00:10:43] dvd: not a dvd - trying as a stream/file instead
[00:10:43] reader: first SCR 0
[00:10:43] encx264: keyint-min: 24, keyint-max: 240
[00:10:43] encx264: encoding with stored aspect 1/1
[00:10:43] encx264: Encoding at constant RF 22.000000
x264 [info]: using SAR=1/1
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.1 Cache64
[00:10:43] decomb thread started for segment 0
[00:10:43] decomb thread started for segment 1
[00:10:43] yadif thread started for segment 0
[00:10:43] yadif thread started for segment 1
x264 [info]: profile Main, level 3.1
[00:10:43] sync: expecting 746 video frames
[00:10:43] sync: adding 1002 ms of silence to audio 0  start 90180, next 0
[00:11:16] reader: done. 1 scr changes
[00:11:35] sync: got 721 frames, 746 expected
[00:11:35] work: average encoding speed for job is 13.747108 fps
[00:11:36] mux: track 0, 1129 frames, 9142798 bytes, 2438.03 kbps, fifo 8
[00:11:36] mux: track 1, 1406 frames, 480053 bytes, 128.01 kbps, fifo 1024
[00:11:36] h264-decoder done: 722 frames, 0 decoder errors, 0 drops
[00:11:36] render: lost time: 0 (0 frames)
[00:11:36] render: gained time: 0 (0 frames) (0 not accounted for)
x264 [info]: slice I:9     Avg QP:14.25  size: 98035  PSNR Mean Y:57.27 U:64.58 V:62.68 Avg:58.17 Global:46.84
x264 [info]: slice P:691   Avg QP:18.14  size: 10830  PSNR Mean Y:43.99 U:47.79 V:48.11 Avg:44.88 Global:42.04
x264 [info]: slice B:429   Avg QP:20.07  size:  1809  PSNR Mean Y:42.59 U:46.34 V:46.80 Avg:43.52 Global:41.21
x264 [info]: consecutive B-frames: 40.8%  7.0% 52.2%
x264 [info]: mb I  I16..4: 41.2%  0.0% 58.8%
x264 [info]: mb P  I16..4:  4.7%  0.0%  2.5%  P16..4: 37.4%  8.0%  8.5%  0.0%  0.0%    skip:38.8%
x264 [info]: mb B  I16..4:  0.6%  0.0%  0.0%  B16..8: 12.5%  0.9%  0.6%  direct: 9.5%  skip:75.9%  L0:29.1% L1:57.1% BI:13.7%
x264 [info]: coded y,uvDC,uvAC intra:29.0% 57.6% 49.8% inter:11.5% 20.7% 3.2%
x264 [info]: ref P L0  81.0% 19.0%
x264 [info]: SSIM Mean Y:0.9840737
x264 [info]: PSNR Mean Y:43.561 U:47.372 V:47.732 Avg:44.470 Global:41.726 kb/s:1554.70
[00:11:36] aac-decoder done: 0 frames, 0 decoder errors, 0 drops
[00:11:36] decomb: yadif deinterlaced 0 | blend deinterlaced 0 | unfiltered 720 | total 720
[00:11:36] libhb: work result = 0
The output comes out at 37.63 fps (in QuickTime), and you can see that there are more frames in it than were decoded (1129 vs. 722):

Code: Select all

[00:11:36] mux: track 0, 1129 frames, 9142798 bytes, 2438.03 kbps, fifo 8
[00:11:36] mux: track 1, 1406 frames, 480053 bytes, 128.01 kbps, fifo 1024
[00:11:36] h264-decoder done: 722 frames, 0 decoder errors, 0 drops
Revision 2354, without b-frames

Code: Select all

HandBrake Activity Log for /Users/tim/Desktop/BigBuckBunnyTest (2354, no patch, no b-frames).mp4: 2009-05-02 00:15:33 +0200
Handbrake Version: svn2354 i386 (2009050201)

[00:15:33] macgui: Rip: Pending queue count is 0
[00:15:33] macgui: Rip: No pending jobs, so sending this one to doAddToQueue
[00:15:33] macgui: Rip: Going right to performNewQueueScan
[00:15:33] macgui: scanning specifically for title: 1
[00:15:33] macgui: performNewQueueScan currentQueueEncodeIndex is: 0
[00:15:33] hb_scan: path=/Volumes/LaCieDisk/excluded/Videos & Movies/Test Clips/BigBuckBunnyTest.mov, title_index=1
[00:15:33] scan: trying to open with libdvdread
[00:15:33] dvd: not a dvd - trying as a stream/file instead
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Volumes/LaCieDisk/excluded/Videos & Movies/Test Clips/BigBuckBunnyTest.mov':
  Duration: 00:00:30.08, start: 0.000000, bitrate: 2055 kb/s
    Stream #0.0(): Audio: aac, 48000 Hz, stereo, s16
    Stream #0.1(): Video: h264, yuv420p, 1920x1080, PAR 1:1 DAR 16:9, 24 tbr, 1k tbn, 2k tbc
[00:15:33] scan: decoding previews for title 1
[00:15:35] Warning: Could not read data for preview 10, skipped
[00:15:35] scan: 9 previews, 1920x1080, 23.999 fps, autocrop = 0/0/0/0, aspect 16:9, PAR 1:1
[00:15:35] scan: title (0) job->width:1936, job->height:1088
[00:15:35] libhb: scan thread found 1 valid title(s)
[00:15:35] macgui: ScanDone state received from fQueueEncodeLibhb
[00:15:35] macgui: processNewQueueEncode title list is: 1
[00:15:35] macgui: Preset: ref=2:umh:bframes=2
[00:15:35] macgui: processNewQueueEncode number of passes expected is: 1
[00:15:35] macgui: prepareJob exiting
[00:15:35] 1 job(s) to process
[00:15:35] starting job
[00:15:35] job configuration:
[00:15:35]  * source
[00:15:35]    + /Volumes/LaCieDisk/excluded/Videos & Movies/Test Clips/BigBuckBunnyTest.mov
[00:15:35]    + title 1, chapter(s) 1 to 1
[00:15:35]    + container: mov,mp4,m4a,3gp,3g2,mj2
[00:15:35]    + data rate: 2055 kbps
[00:15:35]  * destination
[00:15:35]    + /Users/tim/Desktop/BigBuckBunnyTest (2354, no patch, no b-frames).mp4
[00:15:35]    + container: MPEG-4 (.mp4 and .m4v)
[00:15:35]  * video track
[00:15:35]    + decoder: h264
[00:15:35]    + frame rate: same as source (around 23.999 fps)
[00:15:35]    + loose anamorphic
[00:15:35]      + storage dimensions: 1920 * 1080 -> 1024 * 576, crop 0/0/0/0
[00:15:35]      + pixel aspect ratio: 1 / 1
[00:15:35]      + display dimensions: 1024 * 576
[00:15:35]    + filter
[00:15:35]      + Decomb (default settings)
[00:15:35]    + encoder: x264
[00:15:35]      + options: ref=2:me=umh
[00:15:35]      + quality: 22.00 (RF)
[00:15:35]  * audio track 0
[00:15:35]    + decoder: Unknown (AAC) (track 1, id 0)
[00:15:35]    + mixdown: Stereo
[00:15:35]    + dynamic range compression: 1.000000
[00:15:35]    + encoder: faac
[00:15:35]      + bitrate: 128 kbps, samplerate: 48000 Hz
[00:15:35] dvd: not a dvd - trying as a stream/file instead
[00:15:35] reader: first SCR 0
[00:15:35] yadif thread started for segment 0
[00:15:35] yadif thread started for segment 1
[00:15:35] encx264: keyint-min: 24, keyint-max: 240
[00:15:35] decomb thread started for segment 0
[00:15:35] encx264: encoding with stored aspect 1/1
[00:15:35] encx264: Encoding at constant RF 22.000000
[00:15:35] decomb thread started for segment 1
x264 [info]: using SAR=1/1
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.1 Cache64
x264 [info]: profile Main, level 3.1
[00:15:35] sync: expecting 746 video frames
[00:15:35] sync: adding 1002 ms of silence to audio 0  start 90180, next 0
[00:16:05] reader: done. 1 scr changes
[00:16:23] sync: got 721 frames, 746 expected
[00:16:23] work: average encoding speed for job is 14.816058 fps
[00:16:24] mux: track 0, 720 frames, 7762334 bytes, 2069.91 kbps, fifo 8
[00:16:24] mux: track 1, 1406 frames, 480053 bytes, 128.01 kbps, fifo 1024
[00:16:24] h264-decoder done: 722 frames, 0 decoder errors, 0 drops
[00:16:24] render: lost time: 0 (0 frames)
[00:16:24] render: gained time: 0 (0 frames) (0 not accounted for)
x264 [info]: slice I:7     Avg QP:14.32  size: 94416  PSNR Mean Y:59.69 U:68.23 V:65.84 Avg:60.64 Global:46.45
x264 [info]: slice P:713   Avg QP:20.15  size:  9959  PSNR Mean Y:42.13 U:46.02 V:46.41 Avg:43.06 Global:40.40
x264 [info]: mb I  I16..4: 48.2%  0.0% 51.8%
x264 [info]: mb P  I16..4:  4.7%  0.0%  2.2%  P16..4: 46.4%  8.6%  9.3%  0.0%  0.0%    skip:28.8%
x264 [info]: coded y,uvDC,uvAC intra:24.4% 53.0% 41.2% inter:18.0% 26.4% 4.2%
x264 [info]: ref P L0  68.8% 31.2%
x264 [info]: SSIM Mean Y:0.9789971
x264 [info]: PSNR Mean Y:42.304 U:46.238 V:46.596 Avg:43.232 Global:40.435 kb/s:2069.75
[00:16:24] aac-decoder done: 0 frames, 0 decoder errors, 0 drops
[00:16:24] decomb: yadif deinterlaced 0 | blend deinterlaced 0 | unfiltered 720 | total 720
[00:16:24] libhb: work result = 0
When not using b-frames, the output only has 720 frames (and comes out at 24 fps):

Code: Select all

[00:16:24] mux: track 0, 720 frames, 7762334 bytes, 2069.91 kbps, fifo 8
[00:16:24] mux: track 1, 1406 frames, 480053 bytes, 128.01 kbps, fifo 1024
[00:16:24] h264-decoder done: 722 frames, 0 decoder errors, 0 drops
Revision 2354 plus van's patch, with b-frames

Code: Select all

HandBrake Activity Log for /Users/tim/Desktop/BigBuckBunnyTest (2354, van's patch).mp4: 2009-05-02 00:12:34 +0200
Handbrake Version: svn2354 i386 (2009050101)

[00:12:34] macgui: Rip: Pending queue count is 0
[00:12:34] macgui: Rip: No pending jobs, so sending this one to doAddToQueue
[00:12:34] macgui: Rip: Going right to performNewQueueScan
[00:12:34] macgui: scanning specifically for title: 1
[00:12:34] macgui: performNewQueueScan currentQueueEncodeIndex is: 0
[00:12:34] hb_scan: path=/Volumes/LaCieDisk/excluded/Videos & Movies/Test Clips/BigBuckBunnyTest.mov, title_index=1
[00:12:34] scan: trying to open with libdvdread
[00:12:34] dvd: not a dvd - trying as a stream/file instead
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Volumes/LaCieDisk/excluded/Videos & Movies/Test Clips/BigBuckBunnyTest.mov':
  Duration: 00:00:30.08, start: 0.000000, bitrate: 2055 kb/s
    Stream #0.0(): Audio: aac, 48000 Hz, stereo, s16
    Stream #0.1(): Video: h264, yuv420p, 1920x1080, PAR 1:1 DAR 16:9, 24 tbr, 1k tbn, 2k tbc
[00:12:34] scan: decoding previews for title 1
[00:12:35] Warning: Could not read data for preview 10, skipped
[00:12:35] scan: 9 previews, 1920x1080, 23.999 fps, autocrop = 0/0/0/0, aspect 16:9, PAR 1:1
[00:12:35] scan: title (0) job->width:1936, job->height:1088
[00:12:35] libhb: scan thread found 1 valid title(s)
[00:12:35] macgui: ScanDone state received from fQueueEncodeLibhb
[00:12:35] macgui: processNewQueueEncode title list is: 1
[00:12:35] macgui: Preset: ref=2:umh:bframes=2
[00:12:35] macgui: processNewQueueEncode number of passes expected is: 1
[00:12:35] macgui: prepareJob exiting
[00:12:35] 1 job(s) to process
[00:12:35] starting job
[00:12:35] job configuration:
[00:12:35]  * source
[00:12:35]    + /Volumes/LaCieDisk/excluded/Videos & Movies/Test Clips/BigBuckBunnyTest.mov
[00:12:35]    + title 1, chapter(s) 1 to 1
[00:12:35]    + container: mov,mp4,m4a,3gp,3g2,mj2
[00:12:35]    + data rate: 2055 kbps
[00:12:35]  * destination
[00:12:35]    + /Users/tim/Desktop/BigBuckBunnyTest (2354, van's patch).mp4
[00:12:35]    + container: MPEG-4 (.mp4 and .m4v)
[00:12:35]  * video track
[00:12:35]    + decoder: h264
[00:12:35]    + frame rate: same as source (around 23.999 fps)
[00:12:35]    + loose anamorphic
[00:12:35]      + storage dimensions: 1920 * 1080 -> 1024 * 576, crop 0/0/0/0
[00:12:35]      + pixel aspect ratio: 1 / 1
[00:12:35]      + display dimensions: 1024 * 576
[00:12:35]    + filter
[00:12:35]      + Decomb (default settings)
[00:12:35]    + encoder: x264
[00:12:35]      + options: ref=2:me=umh:bframes=2
[00:12:35]      + quality: 22.00 (RF)
[00:12:35]  * audio track 0
[00:12:35]    + decoder: Unknown (AAC) (track 1, id 0)
[00:12:35]    + mixdown: Stereo
[00:12:35]    + dynamic range compression: 1.000000
[00:12:35]    + encoder: faac
[00:12:35]      + bitrate: 128 kbps, samplerate: 48000 Hz
[00:12:35] dvd: not a dvd - trying as a stream/file instead
[00:12:35] reader: first SCR 0
[00:12:35] yadif thread started for segment 0
[00:12:35] yadif thread started for segment 1
[00:12:35] decomb thread started for segment 0
[00:12:35] decomb thread started for segment 1
[00:12:35] encx264: keyint-min: 24, keyint-max: 240
[00:12:35] encx264: encoding with stored aspect 1/1
[00:12:35] encx264: Encoding at constant RF 22.000000
x264 [info]: using SAR=1/1
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.1 Cache64
x264 [info]: profile Main, level 3.1
[00:12:35] sync: expecting 746 video frames
[00:12:35] sync: adding 1002 ms of silence to audio 0  start 90180, next 0
[00:13:02] reader: done. 1 scr changes
[00:13:17] sync: got 721 frames, 746 expected
[00:13:17] work: average encoding speed for job is 17.007618 fps
[00:13:18] mux: track 0, 720 frames, 6036518 bytes, 1609.70 kbps, fifo 8
[00:13:18] mux: track 1, 1406 frames, 480053 bytes, 128.01 kbps, fifo 1024
[00:13:18] h264-decoder done: 722 frames, 0 decoder errors, 0 drops
[00:13:18] render: lost time: 0 (0 frames)
[00:13:18] render: gained time: 0 (0 frames) (0 not accounted for)
x264 [info]: slice I:7     Avg QP:15.01  size: 84628  PSNR Mean Y:59.08 U:67.72 V:65.37 Avg:60.06 Global:45.64
x264 [info]: slice P:303   Avg QP:19.51  size: 14935  PSNR Mean Y:43.13 U:47.45 V:47.76 Avg:44.09 Global:40.86
x264 [info]: slice B:410   Avg QP:21.92  size:  2240  PSNR Mean Y:41.21 U:45.23 V:45.81 Avg:42.19 Global:40.32
x264 [info]: consecutive B-frames:  8.0% 23.0% 69.0%
x264 [info]: mb I  I16..4: 48.6%  0.0% 51.4%
x264 [info]: mb P  I16..4: 10.5%  0.0%  5.5%  P16..4: 42.2% 11.4% 11.0%  0.0%  0.0%    skip:19.4%
x264 [info]: mb B  I16..4:  0.7%  0.0%  0.0%  B16..8: 15.5%  1.1%  0.8%  direct: 9.3%  skip:72.5%  L0:30.3% L1:52.7% BI:17.0%
x264 [info]: coded y,uvDC,uvAC intra:26.3% 55.7% 45.0% inter:11.7% 19.1% 2.7%
x264 [info]: ref P L0  73.1% 26.9%
x264 [info]: SSIM Mean Y:0.9796439
x264 [info]: PSNR Mean Y:42.189 U:46.385 V:46.822 Avg:43.166 Global:40.570 kb/s:1609.53
[00:13:18] aac-decoder done: 0 frames, 0 decoder errors, 0 drops
[00:13:18] decomb: yadif deinterlaced 0 | blend deinterlaced 0 | unfiltered 720 | total 720
[00:13:18] libhb: work result = 0
Now, with van's patch, the output has 720 frames even when using b-frames (QuickTime reports 23.97 fps):

Code: Select all

[00:13:18] mux: track 0, 720 frames, 6036518 bytes, 1609.70 kbps, fifo 8
[00:13:18] mux: track 1, 1406 frames, 480053 bytes, 128.01 kbps, fifo 1024
[00:13:18] h264-decoder done: 722 frames, 0 decoder errors, 0 drops
Revision 2354 plus van's patch, without b-frames

Code: Select all

HandBrake Activity Log for /Users/tim/Desktop/BigBuckBunnyTest (2354, van's patch, no b-frames).mp4: 2009-05-02 00:13:59 +0200
Handbrake Version: svn2354 i386 (2009050101)

[00:13:59] macgui: Rip: Pending queue count is 0
[00:13:59] macgui: Rip: No pending jobs, so sending this one to doAddToQueue
[00:13:59] macgui: Rip: Going right to performNewQueueScan
[00:13:59] macgui: scanning specifically for title: 1
[00:13:59] macgui: performNewQueueScan currentQueueEncodeIndex is: 1
[00:13:59] hb_scan: path=/Volumes/LaCieDisk/excluded/Videos & Movies/Test Clips/BigBuckBunnyTest.mov, title_index=1
[00:13:59] scan: trying to open with libdvdread
[00:13:59] dvd: not a dvd - trying as a stream/file instead
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Volumes/LaCieDisk/excluded/Videos & Movies/Test Clips/BigBuckBunnyTest.mov':
  Duration: 00:00:30.08, start: 0.000000, bitrate: 2055 kb/s
    Stream #0.0(): Audio: aac, 48000 Hz, stereo, s16
    Stream #0.1(): Video: h264, yuv420p, 1920x1080, PAR 1:1 DAR 16:9, 24 tbr, 1k tbn, 2k tbc
[00:13:59] scan: decoding previews for title 1
[00:14:00] Warning: Could not read data for preview 10, skipped
[00:14:00] scan: 9 previews, 1920x1080, 23.999 fps, autocrop = 0/0/0/0, aspect 16:9, PAR 1:1
[00:14:00] scan: title (0) job->width:1936, job->height:1088
[00:14:00] libhb: scan thread found 1 valid title(s)
[00:14:01] macgui: currentScanCount received from fQueueEncodeLibhb
[00:14:01] macgui: ScanDone state received from fQueueEncodeLibhb
[00:14:01] macgui: processNewQueueEncode title list is: 1
[00:14:01] macgui: Preset: ref=2:umh:bframes=2
[00:14:01] macgui: processNewQueueEncode number of passes expected is: 1
[00:14:01] macgui: prepareJob exiting
[00:14:01] 1 job(s) to process
[00:14:01] starting job
[00:14:01] job configuration:
[00:14:01]  * source
[00:14:01]    + /Volumes/LaCieDisk/excluded/Videos & Movies/Test Clips/BigBuckBunnyTest.mov
[00:14:01]    + title 1, chapter(s) 1 to 1
[00:14:01]    + container: mov,mp4,m4a,3gp,3g2,mj2
[00:14:01]    + data rate: 2055 kbps
[00:14:01]  * destination
[00:14:01]    + /Users/tim/Desktop/BigBuckBunnyTest (2354, van's patch, no b-frames).mp4
[00:14:01]    + container: MPEG-4 (.mp4 and .m4v)
[00:14:01]  * video track
[00:14:01]    + decoder: h264
[00:14:01]    + frame rate: same as source (around 23.999 fps)
[00:14:01]    + loose anamorphic
[00:14:01]      + storage dimensions: 1920 * 1080 -> 1024 * 576, crop 0/0/0/0
[00:14:01]      + pixel aspect ratio: 1 / 1
[00:14:01]      + display dimensions: 1024 * 576
[00:14:01]    + filter
[00:14:01]      + Decomb (default settings)
[00:14:01]    + encoder: x264
[00:14:01]      + options: ref=2:me=umh
[00:14:01]      + quality: 22.00 (RF)
[00:14:01]  * audio track 0
[00:14:01]    + decoder: Unknown (AAC) (track 1, id 0)
[00:14:01]    + mixdown: Stereo
[00:14:01]    + dynamic range compression: 1.000000
[00:14:01]    + encoder: faac
[00:14:01]      + bitrate: 128 kbps, samplerate: 48000 Hz
[00:14:01] dvd: not a dvd - trying as a stream/file instead
[00:14:01] reader: first SCR 0
[00:14:01] yadif thread started for segment 0
[00:14:01] yadif thread started for segment 1
[00:14:01] decomb thread started for segment 0
[00:14:01] decomb thread started for segment 1
[00:14:01] encx264: keyint-min: 24, keyint-max: 240
[00:14:01] encx264: encoding with stored aspect 1/1
[00:14:01] encx264: Encoding at constant RF 22.000000
x264 [info]: using SAR=1/1
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.1 Cache64
x264 [info]: profile Main, level 3.1
[00:14:01] sync: expecting 746 video frames
[00:14:01] sync: adding 1002 ms of silence to audio 0  start 90180, next 0
[00:14:30] reader: done. 1 scr changes
[00:14:48] sync: got 721 frames, 746 expected
[00:14:48] work: average encoding speed for job is 15.136958 fps
[00:14:49] mux: track 0, 720 frames, 7762334 bytes, 2069.91 kbps, fifo 8
[00:14:49] mux: track 1, 1406 frames, 480053 bytes, 128.01 kbps, fifo 1024
[00:14:49] h264-decoder done: 722 frames, 0 decoder errors, 0 drops
[00:14:49] render: lost time: 0 (0 frames)
[00:14:49] render: gained time: 0 (0 frames) (0 not accounted for)
x264 [info]: slice I:7     Avg QP:14.32  size: 94416  PSNR Mean Y:59.69 U:68.23 V:65.84 Avg:60.64 Global:46.45
x264 [info]: slice P:713   Avg QP:20.15  size:  9959  PSNR Mean Y:42.13 U:46.02 V:46.41 Avg:43.06 Global:40.40
x264 [info]: mb I  I16..4: 48.2%  0.0% 51.8%
x264 [info]: mb P  I16..4:  4.7%  0.0%  2.2%  P16..4: 46.4%  8.6%  9.3%  0.0%  0.0%    skip:28.8%
x264 [info]: coded y,uvDC,uvAC intra:24.4% 53.0% 41.2% inter:18.0% 26.4% 4.2%
x264 [info]: ref P L0  68.8% 31.2%
x264 [info]: SSIM Mean Y:0.9789971
x264 [info]: PSNR Mean Y:42.304 U:46.238 V:46.596 Avg:43.232 Global:40.435 kb/s:2069.75
[00:14:49] aac-decoder done: 0 frames, 0 decoder errors, 0 drops
[00:14:49] decomb: yadif deinterlaced 0 | blend deinterlaced 0 | unfiltered 720 | total 720
[00:14:49] libhb: work result = 0
Same when not using b-frames: 720 frames, 23.97 fps:

Code: Select all

[00:14:49] mux: track 0, 720 frames, 7762334 bytes, 2069.91 kbps, fifo 8
[00:14:49] mux: track 1, 1406 frames, 480053 bytes, 128.01 kbps, fifo 1024
[00:14:49] h264-decoder done: 722 frames, 0 decoder errors, 0 drops
Last edited by Rodeo on Fri May 01, 2009 11:03 pm, edited 1 time in total.

User avatar
Rodeo
HandBrake Team
Posts: 12401
Joined: Tue Mar 03, 2009 8:55 pm

Re: [Invalid] [SVN 2263] Incorrect Framerate

Post by Rodeo »

BTW, I figured out why the output with the patch is 23.97 fps vs. 24 without the patch:

With van's patch, the duration (as reported by QuickTime) is 30.04 seconds (720/30.04 = 23.97), whereas the duration is 30.00 seconds without the patch. The source's duration when opened in QuickTime is 30.00 seconds, not 30.04.

I should probably report this in the patch's thread, right?

downinitjr
Posts: 18
Joined: Wed Oct 01, 2008 1:23 am

Re: [Invalid] [SVN 2263] Incorrect Framerate

Post by downinitjr »

jbrjake wrote:
downinitjr wrote:Funny how this was an invalid bug, yet after applying the patch van wrote, everything is back to normal.
Clarify please so I can correctly interpret your snark: are you just applying the patch, or are you applying the patch as well as following van's advice to set a constant output fps?
:) So far I've just applied the patch and used the TV preset (changed to 1280 x whatever). Before patching, consistently getting encodes that would not play/sync to TV. After the patch, same preset, files are once again working on the TV while using same as source. To be honest thats all I know, I have no clue whats going on, I'm just glad it works for me again.

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

Re: [Invalid] [SVN 2263] Incorrect Framerate

Post by jbrjake »

You guys are pointing to a particular comment of van's about a very specific problem with source files, that can only be worked around by shaping to a constant FPS...

Since for some reason you're not using the interface that's actually been patched to use the new framerate system (the CLI) I can't be entirely sure what you're actually sending to the lib, although it appears to be settling on job->cfr=0. The thing is, though, in that case, the very specific workaround van pointed to wouldn't be effective. He's describing an issue with code he added to encx264.c to split frames into multiple frames when the init_delay is smaller than the frame's duration, which can go wrong with badly muxed mkv sources that don't have accurate frame durations. Only, using cfr==0, that code functions exactly the same way it did without the patch....since the workaround is to set a constant framerate, which would smooth the frame durations to a constant duration and tune the init_delay based on the specific framerate to ensure it was bigger than the constant frame duration.

User avatar
Rodeo
HandBrake Team
Posts: 12401
Joined: Tue Mar 03, 2009 8:55 pm

Re: [Invalid] [SVN 2263] Incorrect Framerate

Post by Rodeo »

jbrjake wrote:You guys are pointing to a particular comment of van's about a very specific problem with source files, that can only be worked around by shaping to a constant FPS...

Since for some reason you're not using the interface that's actually been patched to use the new framerate system (the CLI) I can't be entirely sure what you're actually sending to the lib, although it appears to be settling on job->cfr=0. The thing is, though, in that case, the very specific workaround van pointed to wouldn't be effective. He's describing an issue with code he added to encx264.c to split frames into multiple frames when the init_delay is smaller than the frame's duration, which can go wrong with badly muxed mkv sources that don't have accurate frame durations. Only, using cfr==0, that code functions exactly the same way it did without the patch....since the workaround is to set a constant framerate, which would smooth the frame durations to a constant duration and tune the init_delay based on the specific framerate to ensure it was bigger than the constant frame duration.
I can't explain why Van's patch makes a difference, all I can do is notice the difference.

Anyway, if I am not mistaken, the init_delay issues that sometimes require frames to be split is only relevant when b-frames are used, so when b-frames aren't used this code should never have to be called. Is that correct?

If so, and from the tests I've done above, I come to the following conclusions:

1) when using revision 2354 without the patch (using b-frames), something (whether it's the MKV problem van suggested in the other thread, or something else) is causing the init_delay to be smaller than the frame duration, and therefore triggers van's "frame splitting" code (since more frames are muxed in the output than were decoded and/or than when not using b-frames);

2) something in Van's patch is causing this code not to be called, at least in the specific conditions of my test.

Also, generally, with non-DVD sources (MKV or not), I always see a slight increase in frame rate when using b-frames vs. not using b-frames (even though it rarely as obvious as 37.63 vs. 24 fps, usually only like 0.1 to 0.2 extra fps). With van's patch applied, I rarely ever get any difference, and it's at most 0.01 extra fps.

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

Re: [Invalid] [SVN 2263] Incorrect Framerate

Post by van »

I finally figured out the reason why the patch gets rid of the encx264 frame splitting for VFR. It's an unintended consequence of this piece:

Code: Select all

--- libhb/encx264.c    (revision 2353)
+++ libhb/encx264.c    (working copy)
@@ -347,7 +347,7 @@
         /* For VFR, libhb sees the FPS as 29.97, but the longest frames
            will use the duration of frames running at 23.976fps instead.. */
-        if (job->vfr)
+        if ( job->cfr != 1 )
         {
             pv->init_delay = 7506;
         }
It used to be that there were separate controls for vfr and cfr for reasons that mostly had to do with the frame rate controls happening too early. The patch moved the frame rate code to after all the filters have been applied so job->vfr & job->cfr became one control. But this change in encx264 has the side effect of making init_delay large for normal (VFR) encodes (it used to be that init_delay was inflated only when you specified VFR and detelecine which is what the old 'job->vfr' meant).

Although unintentional it turns out that this change was a good idea. The code in this section of encx264 was done when HB only handled DVDs. The media standards for DVDs were created by people who understood that high quality timing is essential for good multimedia playback. But now HB also handles mkvs, movs, ..., and those containers allow really dumb clocks to be specified. For example, the default clock used in mkvs seems to be 1KHz (90 times worse than MPEG2). Since quantization always makes interframe times for variable rate video be +-2 clock ticks, these coarse clocks mean we have to accommodate a jitter of 4*90 = 360 ticks of HB's 90KHz clock. This section of code was set up to handle a jitter of 4 ticks because that's as bad as a DVD can get. So the patch helps compensate for crummy clocks.

But as jbrjake explained, the frame durations in the source material can be arbitrarily bad. The patch makes HB more conservative for VFR content but doesn't guarantee that frames won't need to be split (which will make the output frame rate higher than the input's). The only way to guarantee no splits and a particular output frame rate is to select CFR.

Anyway, since I think I understand what's going on, I've committed the patch as r2368.

User avatar
Rodeo
HandBrake Team
Posts: 12401
Joined: Tue Mar 03, 2009 8:55 pm

Re: [Invalid] [SVN 2263] Incorrect Framerate

Post by Rodeo »

Thanks a lot for the explanation. I guess this explains why applying your patch has a similar effect as my hack of increasing job->areBframes in encx264.c (which in turn increased pv->init_delay).
van wrote:But as jbrjake explained, the frame durations in the source material can be arbitrarily bad. The patch makes HB more conservative for VFR content but doesn't guarantee that frames won't need to be split (which will make the output frame rate higher than the input's). The only way to guarantee no splits and a particular output frame rate is to select CFR.
Indeed, I still sometimes see slightly increased framerate, even with your patch, but way less than without :-)

If you don't mind, do you have an idea why your patch changes the duration on my source though (source is 30.00 s., and I also get 30.00 s. without your patch but 30.04 seconds with your patch)?

Anyway, I'll do some more tests with other sources when I have the time. I already tested some DVD sources, but they seemed unaffected (I get the same duration with and without the patch).

Post Reply