[FFmpeg-user] trouble with -vcodec copy

Arlo Leach lists at arlomedia.com
Wed Nov 9 18:29:44 CET 2011


Hello,

I'm converting user-uploaded videos to H.264/MP4 files with ffmpeg 0.6.1 (obtained from yum on CentOS):

ffmpeg -i input.mov -f mp4 -vcodec libx264 -vpre medium -acodec libfaac -r 15 -b 360k -ab 48k -ar 22050 -s 480x320 fullclip.mp4

Then I want to extract sample clips from those videos. This should give me the first 30 seconds:

ffmpeg -i fullclip.mp4 -vcodec copy -acodec copy -ss 0 -t 30 sampleclip.mp4

But when I do that, the sampleclip.mp4 file has no video track. I don't see an error message from ffmpeg; it just shows a final video size of 0kb in its output.

If I apply the second command to the H.264/MP4 demo clip that came with JWPlayer, I have no problems. But if I re-encode that clip with my first command, then apply the second command, the video conversion fails again. So it looks like my second command is OK but my first command is missing something to make the file complete. Unfortunately I've tried adding lots of additional options gathered from various tutorial sites and none have fixed the problem.

If I change -vcodec copy to -vcodec libx264 in my second command, I do get a video track, but I would rather not re-encode the video when I extract the sample.

I'm pasting full examples (using shorter videos) below. Can anyone see what's wrong?

Thanks,
-Arlo

_______________________________


Encoding command:
/usr/bin/ffmpeg -i /tmp/php5GkSrD -f mp4 -vcodec libx264 -vpre medium -acodec libfaac -r 15 -b 360k -ab 48k -ar 22050 -s 512x288 -t 900 175.mp4

Encoding output:
FFmpeg version 0.6.1, Copyright (c) 2000-2010 the FFmpeg developers
  built on Dec  4 2010 15:35:31 with gcc 4.1.2 20080704 (Red Hat 4.1.2-48)
  configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --incdir=/usr/include --disable-avisynth --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fPIC' --enable-avfilter --enable-avfilter-lavf --enable-libdirac --enable-libfaac --enable-libfaad --enable-libfaadbin --enable-libgsm --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-gpl --enable-nonfree --enable-postproc --enable-pthreads --enable-shared --enable-swscale --enable-vdpau --enable-version3 --enable-x11grab
  libavutil     50.15. 1 / 50.15. 1
  libavcodec    52.72. 2 / 52.72. 2
  libavformat   52.64. 2 / 52.64. 2
  libavdevice   52. 2. 0 / 52. 2. 0
  libavfilter    1.19. 0 /  1.19. 0
  libswscale     0.11. 0 /  0.11. 0
  libpostproc   51. 2. 0 / 51. 2. 0
Seems stream 0 codec frame rate differs from container frame rate: 180000.00 (180000/1) -> 29.97 (30000/1001)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/tmp/php5GkSrD':
  Metadata:
    major_brand     : qt
    minor_version   : 537199360
    compatible_brands: qt
    encoder         : HandBrake 0.9.5 2011010300
  Duration: 00:00:03.26, start: 0.000000, bitrate: 5407 kb/s
    Stream #0.0(): Video: h264, yuv420p, 1024x576 [PAR 1:1 DAR 16:9], 5223 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 180k tbc
    Stream #0.1(eng): Audio: aac, 48000 Hz, stereo, s16, 171 kb/s
[libx264 @ 0x282e0e0]using SAR=1/1
[libx264 @ 0x282e0e0]using cpu capabilities: MMX2 SSE2Fast FastShuffle SSEMisalign LZCNT
[libx264 @ 0x282e0e0]profile High, level 2.1
[libx264 @ 0x282e0e0]264 - core 107 - H.264/MPEG-4 AVC codec - Copyleft 2003-2010 - http://www.videolan.org/x264.html - options: cabac=1 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=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=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=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=360 ratetol=11.1 qcomp=0.60 qpmin=10 qpmax=51 qpstep=4 ip_ratio=1.41 aq=1:1.00
Output #0, mp4, to '175.mp4':
  Metadata:
    encoder         : Lavf52.64.2
    Stream #0.0(): Video: libx264, yuv420p, 512x288 [PAR 1:1 DAR 16:9], q=10-51, 360 kb/s, 15 tbn, 15 tbc
    Stream #0.1(eng): Audio: libfaac, 22050 Hz, stereo, s16, 48 kb/s
Stream mapping:
  Stream #0.0 -> #0.0
  Stream #0.1 -> #0.1
Press [q] to stop encoding
frame=   19 fps=  0 q=-1.0 size=       0kB time=1.86 bitrate=   0.2kbits/s dup=0 drop=18    
frame=   41 fps= 39 q=-1.0 size=       0kB time=3.11 bitrate=   0.1kbits/s dup=0 drop=40    
frame=   49 fps= 21 q=-1.0 Lsize=     149kB time=3.13 bitrate= 390.4kbits/s dup=0 drop=49
video:128kB audio:19kB global headers:0kB muxing overhead 1.678923%
[libx264 @ 0x282e0e0]frame I:1     Avg QP:27.47  size: 34806
[libx264 @ 0x282e0e0]frame P:27    Avg QP:34.61  size:  3092
[libx264 @ 0x282e0e0]frame B:21    Avg QP:39.38  size:   581
[libx264 @ 0x282e0e0]consecutive B-frames: 12.5% 87.5%  0.0%  0.0%
[libx264 @ 0x282e0e0]mb I  I16..4:  1.6% 29.2% 69.3%
[libx264 @ 0x282e0e0]mb P  I16..4:  0.2%  0.3%  0.3%  P16..4: 24.7% 20.2% 14.9%  0.0%  0.0%    skip:39.5%
[libx264 @ 0x282e0e0]mb B  I16..4:  0.0%  0.0%  0.0%  B16..8: 30.2%  6.1%  1.4%  direct: 1.6%  skip:60.7%  L0:31.0% L1:60.4% BI: 8.6%
[libx264 @ 0x282e0e0]final ratefactor: 27.48
[libx264 @ 0x282e0e0]8x8 transform intra:30.9% inter:43.7%
[libx264 @ 0x282e0e0]coded y,uvDC,uvAC intra: 86.6% 90.9% 75.6% inter: 14.6% 8.6% 1.7%
[libx264 @ 0x282e0e0]i16 v,h,dc,p: 44% 12% 26% 18%
[libx264 @ 0x282e0e0]i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 20% 11% 17%  8%  8%  7%  8% 11% 11%
[libx264 @ 0x282e0e0]i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 17% 13% 15%  8%  9%  8%  9% 10% 10%
[libx264 @ 0x282e0e0]i8c dc,h,v,p: 55% 15% 21%  8%
[libx264 @ 0x282e0e0]Weighted P-Frames: Y:0.0%
[libx264 @ 0x282e0e0]ref P L0: 72.9% 13.0%  8.2%  6.0%
[libx264 @ 0x282e0e0]ref B L0: 89.4% 10.6%
[libx264 @ 0x282e0e0]kb/s:319.57

Excerpt command:
/usr/bin/ffmpeg -i 175.mp4 -f mp4 -vcodec copy -acodec copy -ss 1 -t 2 -y 175_sample.mp4

Excerpt output:
FFmpeg version 0.6.1, Copyright (c) 2000-2010 the FFmpeg developers
  built on Dec  4 2010 15:35:31 with gcc 4.1.2 20080704 (Red Hat 4.1.2-48)
  configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --incdir=/usr/include --disable-avisynth --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fPIC' --enable-avfilter --enable-avfilter-lavf --enable-libdirac --enable-libfaac --enable-libfaad --enable-libfaadbin --enable-libgsm --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-gpl --enable-nonfree --enable-postproc --enable-pthreads --enable-shared --enable-swscale --enable-vdpau --enable-version3 --enable-x11grab
  libavutil     50.15. 1 / 50.15. 1
  libavcodec    52.72. 2 / 52.72. 2
  libavformat   52.64. 2 / 52.64. 2
  libavdevice   52. 2. 0 / 52. 2. 0
  libavfilter    1.19. 0 /  1.19. 0
  libswscale     0.11. 0 /  0.11. 0
  libpostproc   51. 2. 0 / 51. 2. 0
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '175.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf52.64.2
  Duration: 00:00:03.26, start: 0.000000, bitrate: 374 kb/s
    Stream #0.0(): Video: h264, yuv420p, 512x288 [PAR 1:1 DAR 16:9], 321 kb/s, 15 fps, 15 tbr, 15 tbn, 30 tbc
    Stream #0.1(eng): Audio: aac, 22050 Hz, stereo, s16, 48 kb/s
Output #0, mp4, to '175_sample.mp4':
  Metadata:
    encoder         : Lavf52.64.2
    Stream #0.0(): Video: libx264, yuv420p, 512x288 [PAR 1:1 DAR 16:9], q=2-31, 321 kb/s, 15 tbn, 15 tbc
    Stream #0.1(eng): Audio: libfaac, 22050 Hz, stereo, 48 kb/s
Stream mapping:
  Stream #0.0 -> #0.0
  Stream #0.1 -> #0.1
Press [q] to stop encoding
frame=    0 fps=  0 q=-1.0 Lsize=      13kB time=2.02 bitrate=  51.2kbits/s
video:0kB audio:12kB global headers:0kB muxing overhead 8.727150%




More information about the ffmpeg-user mailing list