jslhs / ffmbc

Automatically exported from code.google.com/p/ffmbc
0 stars 0 forks source link

FFmbc adding some audio samples to the end of my encoded video #50

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi, for some of my input sources FFmbc seems to be adding some audio samples to 
the end of my encoded video.
This causes the overall frame count to be increased by 1 and the final frame is 
just a blank screen.

According to Adobe Premiere Pro my input file has 265 frames but the output 
from FFmbc contains 266.
In addition, MediaInfo shows a SamplingCount of 509952 (vs 508800 for the 
source).

What version of the product are you using? On what operating system?
FFmbc-0.6-rc7 on OS X 10.6.7

Please provide any additional information below:

- Full commandline run (with -v 3) and everything the program printed
without
the repeating parts.
ffmbc -v 3 -i master.mov -vcodec libx264 -g 5 -coder 0 -b 6000k -maxrate 6000k 
-bufsize 5097k -acodec libfaac -ab 96k -ar 48000 -ac 1 -aprofile 1 -async 100 
-f mov -y proxy.mov

FFmbc version 0.6-rc7
Copyright (c) 2008-2011 Baptiste Coudurier and the FFmpeg developers
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'master.mov':
  Metadata:
    major_brand: qt  
    minor_version: 537199360
    compatible_brands: qt  
    creation_time: 2011-06-27 08:51:04
    timecode: 00:26:22:23
  Duration: 00:00:10.60, start: 0.000000, bitrate: 59353 kb/s
    Stream #0.0(eng): Video: mpeg2video, yuv422p, 1280x720p [PAR 1:1 DAR 16:9], 50000 kb/s, 25.00 fps
    Metadata:
      codec_name: XDCAM HD422 720p25
    Stream #0.1(eng): Audio: pcm_s24le, 48000 Hz, 1 channels, s32, 1152 kb/s
    Stream #0.2(eng): Audio: pcm_s24le, 48000 Hz, 1 channels, s32, 1152 kb/s
    Stream #0.3(eng): Audio: pcm_s24le, 48000 Hz, 1 channels, s32, 1152 kb/s
    Stream #0.4(eng): Audio: pcm_s24le, 48000 Hz, 1 channels, s32, 1152 kb/s
    Stream #0.5(eng): Audio: pcm_s24le, 48000 Hz, 1 channels, s32, 1152 kb/s
    Stream #0.6(eng): Audio: pcm_s24le, 48000 Hz, 1 channels, s32, 1152 kb/s
    Stream #0.7(eng): Audio: pcm_s24le, 48000 Hz, 1 channels, s32, 1152 kb/s
    Stream #0.8(eng): Audio: pcm_s24le, 48000 Hz, 1 channels, s32, 1152 kb/s
    Stream #0.9(eng): Data: tmcd / 0x64636D74
    Metadata:
      reel_name(eng): XDCAM_720p_24bit_10sec.MXF
[ffsink @ 0x100e039a0] auto-inserting filter 'auto-inserted scaler 0' between 
the filter 'src' and the filter 'out'
[scale @ 0x100e03b90] w:1280 h:720 fmt:yuv422p -> w:1280 h:720 fmt:yuv420p 
flags:0x4 interlaced:0
[libx264 @ 0x101045c00] using SAR=1/1
[libx264 @ 0x101045c00] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle 
SSE4.2
[libx264 @ 0x101045c00] profile High, level 3.1
[libx264 @ 0x101045c00] 264 - core 115 - H.264/MPEG-4 AVC codec - Copyleft 
2003-2011 - http://www.videolan.org/x264.html - options: cabac=0 ref=3 
deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 
mixed_ref=1 me_range=16 chroma_me=1 trellis=0 8x8dct=1 cqm=0 deadzone=21,11 
fast_pskip=1 chroma_qp_offset=-2 threads=6 sliced_threads=0 nr=0 decimate=1 
interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 
b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=5 
keyint_min=1 scenecut=40 intra_refresh=0 rc_lookahead=21 rc=cbr mbtree=1 
bitrate=6000 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=6000 
vbv_bufsize=5097 nal_hrd=none ip_ratio=1.40 aq=1:1.00
Output #0, mov, to 'proxy.mov':
  Metadata:
    encoder: FFmbc 0.6
    Stream #0.0(und): Video: libx264, yuv420p, 1280x720p [PAR 1:1 DAR 16:9], 6000 kb/s, 25.00 fps
    Stream #0.1(und): Audio: libfaac (LC), 48000 Hz, 1 channels, s16, 96 kb/s
Stream mapping:
  Stream #0.0 -> #0.0
  Stream #0.1 -> #0.1
Press [q] to stop encoding
[mov @ 0x101044a00] color primaries unspecified, assuming 
bt709rate=6328.5kbits/s eta=00:00:01.49                 
[mov @ 0x101044a00] replacing header in front, copying  7.92MB                  

frame=  265 fps= 29 q=-1.0 Lsize=    8113kB time=00:00:10.52 
bitrate=6317.5kbits/s                 
video:7998kB audio:107kB global headers:1kB muxing overhead 0.087901%
[libx264 @ 0x101045c00] frame I:53    Avg QP:17.17  size: 93802
[libx264 @ 0x101045c00] frame P:197   Avg QP:19.27  size: 15669
[libx264 @ 0x101045c00] frame B:15    Avg QP:19.18  size:  8762
[libx264 @ 0x101045c00] consecutive B-frames: 88.7% 11.3%  0.0%  0.0%
[libx264 @ 0x101045c00] mb I  I16..4:  4.4% 75.5% 20.1%
[libx264 @ 0x101045c00] mb P  I16..4:  0.2%  1.9%  0.4%  P16..4: 56.4% 17.5%  
7.2%  0.0%  0.0%    skip:16.4%
[libx264 @ 0x101045c00] mb B  I16..4:  0.0%  0.4%  0.0%  B16..8: 57.4%  7.5%  
0.4%  direct: 2.7%  skip:31.5%  L0:47.0% L1:51.4% BI: 1.5%
[libx264 @ 0x101045c00] 8x8 transform intra:75.6% inter:59.1%
[libx264 @ 0x101045c00] coded y,uvDC,uvAC intra: 94.4% 87.5% 79.1% inter: 14.0% 
16.6% 0.7%
[libx264 @ 0x101045c00] i16 v,h,dc,p: 35% 27%  8% 30%
[libx264 @ 0x101045c00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 13% 15% 48%  5%  3%  4%  
3%  4%  4%
[libx264 @ 0x101045c00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 34% 26% 15%  5%  4%  5%  
4%  4%  4%
[libx264 @ 0x101045c00] i8c dc,h,v,p: 51% 23% 23%  4%
[libx264 @ 0x101045c00] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x101045c00] ref P L0: 66.6%  5.6% 21.2%  6.6%
[libx264 @ 0x101045c00] ref B L0: 76.8% 23.2%
[libx264 @ 0x101045c00] kb/s:6180.94

- Upload your sample somewhere and supply url
http://boncey.org/downloads/PA-574.tar.gz

Original issue reported on code.google.com by boncey@gmail.com on 5 Jul 2011 at 10:49

GoogleCodeExporter commented 8 years ago
I think this is because the frame size for AAC is 1024 samples.

509952 samples is 498 AAC frames.

I remember having similar issues with MP2 audio (also compounded by audio 
frames overlapping).

Exactly the same happens on FFmpeg.

Original comment by mark.him...@gmail.com on 5 Jul 2011 at 3:50

GoogleCodeExporter commented 8 years ago
Thanks for that Mark.
So, if I understand correctly, FFmbc/FFmpeg are padding up to the frame size of 
1024.

However, my input source has a SamplingCount of 508800 and the output has 
509952, that shows a difference of 1152 samples - shouldn't that be less than 
1024?

Thanks, Darren.

Original comment by boncey@gmail.com on 5 Jul 2011 at 4:15

GoogleCodeExporter commented 8 years ago
Because it's more complex than that.

You might not have noticed that the audio in your proxy is delayed by about 
20ms.

I used exactly your command on your master.mov.

I then converted the audio from both the master.mov and proxy.mov to wavs, and 
imported them into Audacity.

ffmbc -v 3 -i master.mov -vn -acodec pcm_s16le -ar 48000 master.wav
ffmbc -v 3 -i proxy.mov -vn -acodec pcm_s16le -ar 48000 proxy.wav

As you can see in the attached images, the audio is delayed by about 20ms and 
there is a *small* section of extra audio at the end.

I am no expert, but I think the initial delay of ~20ms is 1 frame of aac 
(you're extra 1024 samples) and then the extra at the end is the 128 samples.

When I was hitting this problem with MP2 audio it was explained that some 
compressed audio codec's need some startup time. It might be worth asking these 
questions on the ffmpeg-users email list to see if anyone knows more...

Hope that helps explain the issue you are seeing.

Original comment by mark.him...@gmail.com on 5 Jul 2011 at 5:21

Attachments:

GoogleCodeExporter commented 8 years ago
Thanks for your help Mark, we'll investigate in more detail at our end.

Original comment by boncey@gmail.com on 13 Jul 2011 at 10:06

GoogleCodeExporter commented 8 years ago

Original comment by baptiste...@gmail.com on 26 Jul 2011 at 10:54