audio problems with short clips

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.

*******************************
Post Reply
ptone
Posts: 7
Joined: Sun Mar 18, 2007 5:50 pm

audio problems with short clips

Post by ptone »

I'm trying to encode a number of shorter AVI clips - what I find is that on moderately short clips (like 15-30s) the first second or so of audio is missing from the final file.

For short clips (like 5 seconds) the audio is extremely choppy, nearly absent and/or highly distorted.

This is clearly "intentional" as the silence insertion is clearly present in the activity log, but why so much? Other tools don't seem to have this problem. I'm using the CLI version - but the exact problems (at the exact locations) happen via the GUI version.

-Preston

Code: Select all

[18:40:29] macgui: Handbrake Version: 0.9.3 (2008112300)
[18:40:29] hb_init: checking cpu count
[18:40:29] hb_init: starting libhb thread
[18:40:29] hb_init: checking cpu count
[18:40:29] hb_init: starting libhb thread
[18:40:55] macgui: trying to open video_ts folder (parent directory chosen)
[18:40:55] hb_scan: path=/Users/preston/Projects/handbrake-wrapper/inputs/nother/MVI_2889.AVI, title_index=0
[18:40:55] scan: trying to open with libdvdread
[18:40:55] dvd: not a dvd - trying as a stream/file instead
Input #0, avi, from '/Users/preston/Projects/handbrake-wrapper/inputs/nother/MVI_2889.AVI':
  Duration: 00:00:03.30, start: 0.000000, bitrate: 13732 kb/s
    Stream #0.0: Video: mjpeg, yuvj422p, 640x480, 30.00 tb(r)
    Stream #0.1: Audio: pcm_u8, 11024 Hz, mono, s16, 88 kb/s
[18:40:55] scan: decoding previews for title 1
[18:40:56] scan: 10 previews, 640x480, 30.000 fps, autocrop = 0/0/0/0, aspect 4:3, PAR 1:1
[18:40:56] scan: title (0) job->width:640, job->height:480
[18:40:56] libhb: scan thread found 1 valid title(s)
[18:40:56] macgui: ScanDone state received from fHandle
[18:41:12] macgui: Rip: Pending queue count is 0
[18:41:12] macgui: Rip: No pending jobs, so sending this one to doAddToQueue
[18:41:12] macgui: Rip: Going right to performNewQueueScan
[18:41:12] macgui: scanning specifically for title: 1
[18:41:12] macgui: performNewQueueScan currentQueueEncodeIndex is: 0
[18:41:12] hb_scan: path=/Users/preston/Projects/handbrake-wrapper/inputs/nother/MVI_2889.AVI, title_index=1
[18:41:12] scan: trying to open with libdvdread
[18:41:12] dvd: not a dvd - trying as a stream/file instead
Input #0, avi, from '/Users/preston/Projects/handbrake-wrapper/inputs/nother/MVI_2889.AVI':
  Duration: 00:00:03.30, start: 0.000000, bitrate: 13732 kb/s
    Stream #0.0: Video: mjpeg, yuvj422p, 640x480, 30.00 tb(r)
    Stream #0.1: Audio: pcm_u8, 11024 Hz, mono, s16, 88 kb/s
[18:41:12] scan: decoding previews for title 1
[18:41:12] scan: 10 previews, 640x480, 30.000 fps, autocrop = 0/0/0/0, aspect 4:3, PAR 1:1
[18:41:12] scan: title (0) job->width:640, job->height:480
[18:41:12] libhb: scan thread found 1 valid title(s)
[18:41:13] macgui: ScanDone state received from fQueueEncodeLibhb
[18:41:13] macgui: processNewQueueEncode title list is: 1
[18:41:13] macgui: Preset: iPhone & iPod Touch
[18:41:13] macgui: processNewQueueEncode number of passes expected is: 1
[18:41:13] macgui: prepareJob exiting
[18:41:13] 1 job(s) to process
[18:41:13] starting job
[18:41:13] work: sanitizing track 0 mixdown Stereo to Mono
[18:41:13] job configuration:
[18:41:13]  * source
[18:41:13]    + /Users/preston/Projects/handbrake-wrapper/inputs/nother/MVI_2889.AVI
[18:41:13]    + title 1, chapter(s) 1 to 1
[18:41:13]    + container: avi
[18:41:13]    + data rate: 13732 kbps
[18:41:13]  * destination
[18:41:13]    + /Users/preston/Projects/handbrake-wrapper/gui-out/MVI_288bbbbb9.m4v
[18:41:13]    + container: MPEG-4 (.mp4 and .m4v)
[18:41:13]      + chapter markers
[18:41:13]  * video track
[18:41:13]    + decoder: mjpeg
[18:41:13]    + frame rate: same as source (around 30.000 fps)
[18:41:13]    + dimensions: 640 * 480 -> 480 * 368, crop 0/0/0/0
[18:41:13]    + encoder: x264
[18:41:13]      + options: level=30:cabac=0:ref=2:mixed-refs=1:analyse=all:me=umh:no-fast-pskip=1
[18:41:13]      + quality: 0.59
[18:41:13]  * audio track 0
[18:41:13]    + decoder: Unknown (PCM_U8) (track 1, id 1)
[18:41:13]    + mixdown: Mono
[18:41:13]    + encoder: faac
[18:41:13]      + bitrate: 128 kbps, samplerate: 48000 Hz
[18:41:13] dvd: not a dvd - trying as a stream/file instead
[18:41:13] reader: first SCR 0
[18:41:13] encx264: keyint-min: 31, keyint-max: 301
[18:41:13] encx264: Encoding at constant RF 20.910002
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 PHADD SSE4.1 Cache64
x264 [info]: profile Baseline, level 3.0
[18:41:13] sync: expecting 129 video frames
[18:41:13] sync: adding 1000 ms of silence to audio 0  start 90000, next 0
[18:41:13] reader: done. 1 scr changes
[18:41:13] sync: adding 524 ms of silence to audio 0  start 180000, next 132773
[18:41:13] sync: adding 500 ms of silence to audio 0  start 270000, next 225000
[18:41:16] sync: got 98 frames, 129 expected
[18:41:16] work: average encoding speed for job is 0.000000 fps
[18:41:17] mjpeg-decoder done: 99 frames, 0 decoder errors, 0 drops
[18:41:17] render: lost time: 0 (0 frames)
[18:41:17] render: gained time: 0 (0 frames) (0 not accounted for)
x264 [info]: slice I:2     Avg QP:19.56  size: 28265  PSNR Mean Y:43.20 U:46.53 V:46.93 Avg:44.08 Global:44.06
x264 [info]: slice P:96    Avg QP:24.05  size:  7959  PSNR Mean Y:39.65 U:43.77 V:43.83 Avg:40.62 Global:39.93
x264 [info]: mb I  I16..4: 10.7%  0.0% 89.3%
x264 [info]: mb P  I16..4:  2.0%  0.0% 11.3%  P16..4: 51.3% 22.7%  8.6%  0.7%  0.8%    skip: 2.5%
x264 [info]: ref P L0  80.7% 19.3%
x264 [info]: SSIM Mean Y:0.9674287
x264 [info]: PSNR Mean Y:39.724 U:43.828 V:43.894 Avg:40.688 Global:39.985 kb/s:2009.71
[18:41:17] pcm_u8-decoder done: 0 frames, 0 decoder errors, 0 drops
[18:41:17] libhb: work result = 0
[18:41:17] macgui: incrementQueueItemDone currentQueueEncodeIndex is incremented to: 1
[18:41:17] macgui: incrementQueueItemDone the 0 item queue is complete
lone_tree
Experienced
Posts: 75
Joined: Mon May 05, 2008 10:23 pm

Re: audio problems with short clips

Post by lone_tree »

Are you using a preset, and if so, which one? Just curious, but why AVI? Unless you have a specific need for AVI I would recommend using a more modern format like x264 or even mpeg4.
ptone
Posts: 7
Joined: Sun Mar 18, 2007 5:50 pm

Re: audio problems with short clips

Post by ptone »

AVI Is the source from my camera. I'm trying to output to iPhone preset mp4

I tried latest svn version but issue persists.
User avatar
s55
HandBrake Team
Posts: 10350
Joined: Sun Dec 24, 2006 1:05 pm

Re: audio problems with short clips

Post by s55 »

pcm_u8 audio input is broken in the current release.

Wait for 0.9.4 (no eta) or compile the SVN code yourself.
ptone
Posts: 7
Joined: Sun Mar 18, 2007 5:50 pm

Re: audio problems with short clips

Post by ptone »

So I built SVN v 2318 and the problem persists. Now interestingly clips from that camera report as

Stream #0.1: Audio: pcm_s16le, 44100 Hz, mono, s16, 705 kb/s

and in the CLI as:

+ audio tracks:
+ 1, Unknown (PCM_S16)

I have some test clips that I'm happy to upload to demonstrate the problem.

I checked the trac timeline and don't see any changes between 2318 and today that relate to PCM audio

-P

Code: Select all

[06:46:02] hb_init: checking cpu count
[06:46:02] hb_init: starting libhb thread
[06:46:02] macgui: Handbrake Version: svn2318 i386 (2009041101)
[06:46:02] hb_init: checking cpu count
[06:46:02] hb_init: starting libhb thread
[06:46:02] hb_init: checking cpu count
[06:46:02] hb_init: starting libhb thread
[06:46:30] macgui: trying to open video_ts folder (parent directory chosen)
[06:46:30] hb_scan: path=/Users/preston/Desktop/temp/hbproblems/original.AVI, title_index=0
[06:46:30] scan: trying to open with libdvdread
[06:46:30] dvd: not a dvd - trying as a stream/file instead
Input #0, avi, from '/Users/preston/Desktop/temp/hbproblems/original.AVI':
  Duration: 00:00:13.26, start: 0.000000, bitrate: 15478 kb/s
    Stream #0.0: Video: mjpeg, yuvj422p, 640x480, 30 tbr, 30 tbn, 30 tbc
    Stream #0.1: Audio: pcm_s16le, 44100 Hz, mono, s16, 705 kb/s
[06:46:31] scan: decoding previews for title 1
[06:46:31] scan: 10 previews, 640x480, 30.000 fps, autocrop = 0/0/0/0, aspect 4:3, PAR 1:1
[06:46:31] scan: title (0) job->width:640, job->height:480
[06:46:31] libhb: scan thread found 1 valid title(s)
[06:46:32] macgui: ScanDone state received from fHandle
[06:47:03] macgui: Rip: Pending queue count is 0
[06:47:03] macgui: Rip: No pending jobs, so sending this one to doAddToQueue
[06:47:03] macgui: Rip: Going right to performNewQueueScan
[06:47:03] macgui: scanning specifically for title: 1
[06:47:03] macgui: performNewQueueScan currentQueueEncodeIndex is: 0
[06:47:03] hb_scan: path=/Users/preston/Desktop/temp/hbproblems/original.AVI, title_index=1
[06:47:03] scan: trying to open with libdvdread
[06:47:03] dvd: not a dvd - trying as a stream/file instead
Input #0, avi, from '/Users/preston/Desktop/temp/hbproblems/original.AVI':
  Duration: 00:00:13.26, start: 0.000000, bitrate: 15478 kb/s
    Stream #0.0: Video: mjpeg, yuvj422p, 640x480, 30 tbr, 30 tbn, 30 tbc
    Stream #0.1: Audio: pcm_s16le, 44100 Hz, mono, s16, 705 kb/s
[06:47:03] scan: decoding previews for title 1
[06:47:03] scan: 10 previews, 640x480, 30.000 fps, autocrop = 0/0/0/0, aspect 4:3, PAR 1:1
[06:47:03] scan: title (0) job->width:640, job->height:480
[06:47:03] libhb: scan thread found 1 valid title(s)
[06:47:03] macgui: ScanDone state received from fQueueEncodeLibhb
[06:47:03] macgui: processNewQueueEncode title list is: 1
[06:47:03] macgui: Preset: Normal (Default)
[06:47:03] macgui: processNewQueueEncode number of passes expected is: 2
[06:47:03] macgui: prepareJob exiting
[06:47:03] 2 job(s) to process
[06:47:03] starting job
[06:47:03] work: sanitizing track 0 mixdown Stereo to Mono
[06:47:03] job configuration:
[06:47:03]  * source
[06:47:03]    + /Users/preston/Desktop/temp/hbproblems/original.AVI
[06:47:03]    + title 1, chapter(s) 1 to 1
[06:47:03]    + container: avi
[06:47:03]    + data rate: 15478 kbps
[06:47:03]  * destination
[06:47:03]    + /Users/preston/Desktop/temp/hbproblems/guisvn.m4v
[06:47:03]    + container: MPEG-4 (.mp4 and .m4v)
[06:47:03]      + chapter markers
[06:47:03]  * video track
[06:47:03]    + decoder: mjpeg
[06:47:03]    + frame rate: same as source (around 30.000 fps)
[06:47:03]    + strict anamorphic
[06:47:03]      + storage dimensions: 640 * 480 -> 640 * 480, crop 0/0/0/0
[06:47:03]      + pixel aspect ratio: 1 / 1
[06:47:03]      + display dimensions: 640 * 480
[06:47:03]    + encoder: x264
[06:47:03]      + options: ref=2:bframes=2:me=umh:ref=1:subme=1:me=dia:analyse=none:trellis=0:no-fast-pskip=0:8x8dct=0:weightb=0
[06:47:03]      + bitrate: 1500 kbps, pass: 1
[06:47:03]  * audio track 0
[06:47:03]    + decoder: Unknown (PCM_S16) (track 1, id 1)
[06:47:03]    + mixdown: Mono
[06:47:03]    + dynamic range compression: 1.000000
[06:47:03]    + encoder: faac
[06:47:03]      + bitrate: 160 kbps, samplerate: 44100 Hz
[06:47:03] dvd: not a dvd - trying as a stream/file instead
[06:47:03] reader: first SCR 0
[06:47:03] encx264: keyint-min: 31, keyint-max: 301
[06:47:03] encx264: encoding with stored aspect 1/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.0
[06:47:03] sync: expecting 428 video frames
[06:47:03] sync: adding 1000 ms of silence to audio 0  start 90000, next 0
[06:47:17] reader: done. 1 scr changes
[06:47:17] sync: got 397 frames, 428 expected
[06:47:17] work: average encoding speed for job is 26.834862 fps
[06:47:17] mjpeg-decoder done: 398 frames, 0 decoder errors, 0 drops
[06:47:17] render: lost time: 0 (0 frames)
[06:47:17] render: gained time: 0 (0 frames) (0 not accounted for)
x264 [info]: slice I:2     Avg QP:28.03  size: 41180  PSNR Mean Y:35.86 U:40.21 V:42.26 Avg:37.01 Global:36.83
x264 [info]: slice P:174   Avg QP:29.27  size:  9441  PSNR Mean Y:33.46 U:38.68 V:41.22 Avg:34.73 Global:34.51
x264 [info]: slice B:221   Avg QP:31.24  size:  2615  PSNR Mean Y:32.92 U:38.67 V:41.44 Avg:34.25 Global:34.03
x264 [info]: consecutive B-frames:  3.5% 50.1% 46.3%
x264 [info]: mb I  I16..4:  6.5%  0.0% 93.5%
x264 [info]: mb P  I16..4:  2.5%  0.0%  0.0%  P16..4: 84.9%  0.0%  0.0%  0.0%  0.0%    skip:12.7%
x264 [info]: mb B  I16..4:  0.1%  0.0%  0.0%  B16..8: 17.5%  0.0%  0.0%  direct:26.7%  skip:55.8%  L0:25.8% L1:44.6% BI:29.6%
x264 [info]: final ratefactor: 24.37
x264 [info]: SSIM Mean Y:0.9423048
x264 [info]: PSNR Mean Y:33.172 U:38.681 V:41.348 Avg:34.476 Global:34.242 kb/s:1392.29
[06:47:17] pcm_s16le-decoder done: 0 frames, 0 decoder errors, 0 drops
[06:47:17] starting job
[06:47:17] work: sanitizing track 0 mixdown Stereo to Mono
[06:47:17] job configuration:
[06:47:17]  * source
[06:47:17]    + /Users/preston/Desktop/temp/hbproblems/original.AVI
[06:47:17]    + title 1, chapter(s) 1 to 1
[06:47:17]    + container: avi
[06:47:17]    + data rate: 15478 kbps
[06:47:17]  * destination
[06:47:17]    + /Users/preston/Desktop/temp/hbproblems/guisvn.m4v
[06:47:17]    + container: MPEG-4 (.mp4 and .m4v)
[06:47:17]      + chapter markers
[06:47:17]  * video track
[06:47:17]    + decoder: mjpeg
[06:47:17]    + frame rate: same as source (around 30.000 fps)
[06:47:17]    + strict anamorphic
[06:47:17]      + storage dimensions: 640 * 480 -> 640 * 480, crop 0/0/0/0
[06:47:17]      + pixel aspect ratio: 1 / 1
[06:47:17]      + display dimensions: 640 * 480
[06:47:17]    + encoder: x264
[06:47:17]      + options: ref=2:bframes=2:me=umh
[06:47:17]      + bitrate: 1500 kbps, pass: 2
[06:47:17]  * audio track 0
[06:47:17]    + decoder: Unknown (PCM_S16) (track 1, id 1)
[06:47:17]    + mixdown: Mono
[06:47:17]    + dynamic range compression: 1.000000
[06:47:17]    + encoder: faac
[06:47:17]      + bitrate: 160 kbps, samplerate: 44100 Hz
[06:47:17] encx264: keyint-min: 31, keyint-max: 301
[06:47:17] encx264: encoding with stored aspect 1/1
[06:47:17] dvd: not a dvd - trying as a stream/file instead
x264 [info]: using SAR=1/1
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.1 Cache64
x264 [info]: profile Main, level 3.0
[06:47:17] reader: first SCR 0
[06:47:17] sync: expecting 428 video frames
[06:47:17] sync: adding 1000 ms of silence to audio 0  start 90000, next 0
[06:47:31] reader: done. 1 scr changes
[06:47:32] sync: got 397 frames, 428 expected
[06:47:32] work: average encoding speed for job is 25.471699 fps
[06:47:32] mjpeg-decoder done: 398 frames, 0 decoder errors, 0 drops
[06:47:32] render: lost time: 0 (0 frames)
[06:47:32] render: gained time: 0 (0 frames) (0 not accounted for)
x264 [info]: slice I:2     Avg QP:25.35  size: 53320  PSNR Mean Y:38.08 U:43.20 V:44.93 Avg:39.32 Global:39.27
x264 [info]: slice P:174   Avg QP:28.44  size: 10697  PSNR Mean Y:34.23 U:39.59 V:42.09 Avg:35.52 Global:35.41
x264 [info]: slice B:221   Avg QP:30.19  size:  2148  PSNR Mean Y:33.63 U:39.51 V:42.25 Avg:34.97 Global:34.85
x264 [info]: consecutive B-frames:  3.5% 50.1% 46.3%
x264 [info]: mb I  I16..4:  1.8%  0.0% 98.2%
x264 [info]: mb P  I16..4:  0.5%  0.0%  2.4%  P16..4: 52.1% 18.4% 18.4%  0.0%  0.0%    skip: 8.3%
x264 [info]: mb B  I16..4:  0.2%  0.0%  0.0%  B16..8: 26.7%  1.7%  1.3%  direct:13.7%  skip:56.5%  L0:24.1% L1:47.9% BI:27.9%
x264 [info]: ref P L0  82.5% 17.5%
x264 [info]: SSIM Mean Y:0.9519495
x264 [info]: PSNR Mean Y:33.912 U:39.561 V:42.192 Avg:35.234 Global:35.101 kb/s:1476.64
[06:47:32] pcm_s16le-decoder done: 0 frames, 0 decoder errors, 0 drops
[06:47:32] libhb: work result = 0
[06:47:32] macgui: incrementQueueItemDone currentQueueEncodeIndex is incremented to: 1
[06:47:32] macgui: incrementQueueItemDone the 0 item queue is complete
ptone
Posts: 7
Joined: Sun Mar 18, 2007 5:50 pm

Re: audio problems with short clips

Post by ptone »

OK I've posted samples that demonstrate the missing audio.

There is the original AVI plus exports from both .93 and SVN as well as quicktime and VLC which don't show the problem

http://ptone.com/temp/hb_issues/

-Preston
ptone
Posts: 7
Joined: Sun Mar 18, 2007 5:50 pm

Re: audio problems with short clips

Post by ptone »

So should I file a bug on this on the dev trac?

-P
User avatar
s55
HandBrake Team
Posts: 10350
Joined: Sun Dec 24, 2006 1:05 pm

Re: audio problems with short clips

Post by s55 »

no, there is no user registration on trac.

Moving to bugs.

First few seconds of audio are indeed missing. (different issue than the one I thought it was apparently)
jbrjake
Veteran User
Posts: 4805
Joined: Wed Dec 13, 2006 1:38 am

Re: audio problems with short clips

Post by jbrjake »

I fail to see how this is a bug in HandBrake.
[06:47:03] sync: adding 1000 ms of silence to audio 0 start 90000, next 0
[18:41:13] sync: adding 1000 ms of silence to audio 0 start 90000, next 0
[18:41:13] sync: adding 524 ms of silence to audio 0 start 180000, next 132773
[18:41:13] sync: adding 500 ms of silence to audio 0 start 270000, next 225000
Garbage in, garbage out....without sane timestamps, what is HB supposed to do here exactly?
van
Veteran User
Posts: 417
Joined: Wed Aug 29, 2007 6:35 am

Re: audio problems with short clips

Post by van »

The avi file has a corrupted index. The ffmpeg library that Handbrake uses to read avi files can't deal with this. VLC can because it includes code to rebuild the index when it discovers that it's corrupted (ffmpeg doesn't even discover it's corrupted - it just generates weird timestamps on the audio frames).

If long clips work ok my guess is there's a firmware problem in the camera where it's not writing the last block of the file (the index is the last thing in an avi).

There's a cross-platform, open source tool to rebuild an avi index called DivFix++. I ran your clip through it and the result went through the current HB SVN head with no problems.
ptone
Posts: 7
Joined: Sun Mar 18, 2007 5:50 pm

Re: audio problems with short clips

Post by ptone »

as the OP I'm happy to report that this is all fixed in the current version in case anyone with an older vers finds this thread
Post Reply