我使用这个命令来转换:
ffmpeg -copyts -i test.flv -vcodec libx264 -acodec libfaac -f flv test-out.flv
但输出文件中的时间戳与原始文件不同。
test.flv 的起始时间戳不为 0,且有 I、B、P 帧
如何使用输入流时间戳作为输出流时间戳?
非常感谢您的帮助。
FFmpeg 的输出:
ffmpeg -copyts -i test.flv -vcodec libx264 -acodec libfaac -f flv test-out.flv
ffmpeg version 1.2 Copyright (c) 2000-2013 the FFmpeg developers
built on May 3 2013 10:11:18 with gcc 4.1.2 (GCC) 20080704 (Red Hat 4.1.2-48)
configuration: --enable-gpl --enable-nonfree --enable-postproc --enable-pthreads --enable-x11grab --enable-swscale --enable-version3 --disable-ffplay --disable-ffserver --enable-filter=movie --enable-frei0r --enable-libfaac --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fPIC' --extra-ldflags=-ldl --enable-shared --enable-libopenjpeg --enable-encoder=png --enable-encoder=bmp --enable-encoder=wmv1 --enable-encoder=wmv2
libavutil 52. 18.100 / 52. 18.100
libavcodec 54. 92.100 / 54. 92.100
libavformat 54. 63.104 / 54. 63.104
libavdevice 54. 3.103 / 54. 3.103
libavfilter 3. 42.103 / 3. 42.103
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100 / 52. 2.100
Input #0, flv, from 'test.flv':
Metadata:
audiochannels : 1
audiodevice : ?(Realtek High Definition Au
audioinputvolume: 75
author :
copyright :
creationdate : Tue Apr 15 17:08:22 2014
:
description :
fmleversion : 3.2.0.9932
keywords :
lastkeyframetimestamp: 83030
lasttimestamp : 83079
presetname : Medium Bandwidth (300 Kbps) - VP6
rating :
title :
videodevice : HD WebCam
videokeyframe_frequency: 5
Duration: 00:01:23.08, start: 10.000000, bitrate: 257 kb/s
Stream #0:0: Video: vp6f, yuv420p, 320x240, 204 kb/s, 30 tbr, 1k tbn, 1k tbc
Stream #0:1: Audio: mp3, 22050 Hz, mono, s16p, 49 kb/s
[libx264 @ 0x135366c0] using cpu capabilities: MMX2 SSE2Fast FastShuffle SSEMisalign LZCNT
[libx264 @ 0x135366c0] profile High, level 1.3
[libx264 @ 0x135366c0] 264 - core 118 r0+7M 0176d43 - H.264/MPEG-4 AVC codec - Copyleft 2003-2011 - 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 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=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, flv, to 'test-out.flv':
Metadata:
audiochannels : 1
audiodevice : ?(Realtek High Definition Au
audioinputvolume: 75
author :
copyright :
creationdate : Tue Apr 15 17:08:22 2014
:
description :
fmleversion : 3.2.0.9932
keywords :
lastkeyframetimestamp: 83030
lasttimestamp : 83079
presetname : Medium Bandwidth (300 Kbps) - VP6
rating :
title :
videodevice : HD WebCam
videokeyframe_frequency: 5
encoder : Lavf54.63.104
Stream #0:0: Video: h264 ([7][0][0][0] / 0x0007), yuv420p, 320x240, q=-1--1, 1k tbn, 30 tbc
Stream #0:1: Audio: aac ([10][0][0][0] / 0x000A), 22050 Hz, mono, s16, 128 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (vp6f -> libx264)
Stream #0:1 -> #0:1 (mp3 -> libfaac)
Press [q] to stop, [?] for help
frame= 2476 fps=119 q=29.0 Lsize= 2476kB time=00:01:33.13 bitrate= 217.8kbits/s
video:2013kB audio:385kB subtitle:0 global headers:0kB muxing overhead 3.288641%
[libx264 @ 0x135366c0] frame I:10 Avg QP:17.28 size: 12163
[libx264 @ 0x135366c0] frame P:2050 Avg QP:21.13 size: 899
[libx264 @ 0x135366c0] frame B:416 Avg QP:27.54 size: 230
[libx264 @ 0x135366c0] consecutive B-frames: 77.4% 0.2% 0.8% 21.5%
[libx264 @ 0x135366c0] mb I I16..4: 6.5% 81.8% 11.7%
[libx264 @ 0x135366c0] mb P I16..4: 0.4% 1.4% 0.0% P16..4: 30.2% 5.1% 7.1% 0.0% 0.0% skip:55.8%
[libx264 @ 0x135366c0] mb B I16..4: 0.2% 0.2% 0.0% B16..8: 22.5% 1.6% 0.5% direct: 0.8% skip:74.0% L0:49.2% L1:43.8% BI: 7.0%
[libx264 @ 0x135366c0] 8x8 transform intra:77.4% inter:83.6%
[libx264 @ 0x135366c0] coded y,uvDC,uvAC intra: 60.3% 61.2% 18.2% inter: 14.7% 15.7% 1.7%
[libx264 @ 0x135366c0] i16 v,h,dc,p: 18% 45% 36% 2%
[libx264 @ 0x135366c0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 10% 28% 48% 2% 1% 2% 3% 2% 4%
[libx264 @ 0x135366c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 25% 14% 5% 6% 7% 7% 6% 7%
[libx264 @ 0x135366c0] i8c dc,h,v,p: 49% 21% 27% 3%
[libx264 @ 0x135366c0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x135366c0] ref P L0: 74.2% 8.4% 11.4% 6.1%
[libx264 @ 0x135366c0] ref B L0: 86.9% 9.4% 3.7%
[libx264 @ 0x135366c0] ref B L1: 94.8% 5.2%
[libx264 @ 0x135366c0] kb/s:198.42
原因是还是因为我只改变了码率,而没有改变帧率或者分辨率,我不知道这三者之间的关系。