我正在尝试将 24fps 的视频转换为 12fps。虽然转换似乎有效,但 ffmpeg 也增加了输出视频的持续时间(大约长一秒钟)。看起来输出视频应该与源视频相似或更短。
以下是我尝试过的命令:
ffmpeg -i src.mov -r 12 out.mov
ffmpeg -r 24 -i src.mov -r 12 out.mov
完整输出:
$ ffmpeg -i src.mov -r 12 output.mov
ffmpeg version 2.4.3 Copyright (c) 2000-2014 the FFmpeg developers
built on Nov 6 2014 23:40:10 with Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)
configuration: --prefix=/usr/local/Cellar/ffmpeg/2.4.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-avresample --enable-vda --cc=clang --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid
libavutil 54. 7.100 / 54. 7.100
libavcodec 56. 1.100 / 56. 1.100
libavformat 56. 4.101 / 56. 4.101
libavdevice 56. 0.100 / 56. 0.100
libavfilter 5. 1.100 / 5. 1.100
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 0.100 / 3. 0.100
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 0.100 / 53. 0.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fc18980da00] multiple edit list entries, a/v desync might occur, patch welcome
Last message repeated 1 times
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'src.mov':
Metadata:
major_brand : qt
minor_version : 512
compatible_brands: qt
encoder : Lavf54.29.104
xmp : <?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
: <x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.3-c011 66.145661, 2012/02/06-14:56:27 ">
: <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
: <rdf:Description rdf:about=""
: xmlns:xmp="http://ns.adobe.com/xap/1.0/"
: xmlns:xmpDM="http://ns.adobe.com/xmp/1.0/DynamicMedia/"
: xmlns:stDim="http://ns.adobe.com/xap/1.0/sType/Dimensions#"
: xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/"
: xmlns:stEvt="http://ns.adobe.com/xap/1.0/sType/ResourceEvent#"
: xmp:CreateDate="1904-01-01T00:00Z"
: xmp:ModifyDate="2014-12-07T22:15:45Z"
: xmp:MetadataDate="2014-12-07T14:19:26-08:00"
: xmpDM:videoAlphaMode="none"
: xmpDM:audioSampleRate="44100"
: xmpDM:audioSampleType="16Int"
: xmpDM:audioChannelType="Stereo"
: xmpDM:videoFrameRate="24.000000"
: xmpDM:startTimeScale="24"
: xmpDM:startTimeSampleSize="1"
: xmpDM:tapeName=""
: xmpDM:altTapeName=""
: xmpDM:logComment=""
: xmpMM:InstanceID="xmp.iid:0480117407206811822AE6AAF5D55871"
: xmpMM:DocumentID="xmp.did:709C869A082068118083DD6390749A0C"
: xmpMM:OriginalDocumentID="xmp.did:709C869A082068118083DD6390749A0C">
: <xmpDM:videoFrameSize
: stDim:w="1280"
: stDim:h="720"
: stDim:unit="pixel"/>
: <xmpDM:duration
: xmpDM:value="2816"
: xmpDM:scale="1/1000"/>
: <xmpDM:startTimecode
: xmpDM:timeValue="00:00:00:00"
: xmpDM:timeFormat="24Timecode"/>
: <xmpDM:altTimecode
: xmpDM:timeValue="00:00:00:00"
: xmpDM:timeFormat="24Timecode"/>
: <xmpMM:History>
: <rdf:Seq>
: <rdf:li
: stEvt:action="saved"
: stEvt:instanceID="xmp.iid:719C869A082068118083DD6390749A0C"
: stEvt:when="2014-12-07T14:08:22-08:00"
: stEvt:softwareAgent="Adobe Premiere Pro CS6 (Macintosh)"
: stEvt:changed="/"/>
: <rdf:li
: stEvt:action="saved"
: stEvt:instanceID="xmp.iid:729C869A082068118083DD6390749A0C"
: stEvt:when="2014-12-07T14:08:23-08:00"
: stEvt:softwareAgent="Adobe Premiere Pro CS6 (Macintosh)"
: stEvt:changed="/metadata"/>
: <rdf:li
: stEvt:action="modified"
: stEvt:parameters="unknown modifications"/>
: <rdf:li
: stEvt:action="saved"
: stEvt:instanceID="xmp.iid:0180117407206811822AE6AAF5D55871"
: stEvt:when="2014-12-07T14:15:45-08:00"
: stEvt:softwareAgent="Adobe Premiere Pro CS6 (Macintosh)"
: stEvt:changed="/"/>
: <rdf:li
: stEvt:action="saved"
: stEvt:instanceID="xmp.iid:0280117407206811822AE6AAF5D55871"
: stEvt:when="2014-12-07T14:15:46-08:00"
: stEvt:softwareAgent="Adobe Premiere Pro CS6 (Macintosh)"
: stEvt:changed="/metadata"/>
: <rdf:li
: stEvt:action="saved"
: stEvt:instanceID="xmp.iid:0480117407206811822AE6AAF5D55871"
: stEvt:when="2014-12-07T14:19:26-08:00"
: stEvt:softwareAgent="Adobe Premiere Pro CS6 (Macintosh)"
: stEvt:changed="/metadata"/>
: </rdf:Seq>
: </xmpMM:History>
: </rdf:Description>
: </rdf:RDF>
: </x:xmpmeta>
:
:
:
:
:
:
:
:
:
: <?xpacket end="w"?>
Duration: 00:00:02.82, start: 0.238005, bitrate: 2127 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 1503 kb/s, 24 fps, 24 tbr, 24 tbn, 48 tbc (default)
Metadata:
handler_name : Apple Alias Data Handler
Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 191 kb/s (default)
Metadata:
handler_name : Apple Alias Data Handler
[libx264 @ 0x7fc189829a00] using SAR=1/1
[libx264 @ 0x7fc189829a00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX AVX2 FMA3 LZCNT BMI2
[libx264 @ 0x7fc189829a00] profile High, level 3.1
[libx264 @ 0x7fc189829a00] 264 - core 142 r2455 021c0dc - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - 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=12 lookahead_threads=2 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=12 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, mov, to 'output.mov':
Metadata:
major_brand : qt
minor_version : 512
compatible_brands: qt
xmp : <?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
: <x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.3-c011 66.145661, 2012/02/06-14:56:27 ">
: <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
: <rdf:Description rdf:about=""
: xmlns:xmp="http://ns.adobe.com/xap/1.0/"
: xmlns:xmpDM="http://ns.adobe.com/xmp/1.0/DynamicMedia/"
: xmlns:stDim="http://ns.adobe.com/xap/1.0/sType/Dimensions#"
: xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/"
: xmlns:stEvt="http://ns.adobe.com/xap/1.0/sType/ResourceEvent#"
: xmp:CreateDate="1904-01-01T00:00Z"
: xmp:ModifyDate="2014-12-07T22:15:45Z"
: xmp:MetadataDate="2014-12-07T14:19:26-08:00"
: xmpDM:videoAlphaMode="none"
: xmpDM:audioSampleRate="44100"
: xmpDM:audioSampleType="16Int"
: xmpDM:audioChannelType="Stereo"
: xmpDM:videoFrameRate="24.000000"
: xmpDM:startTimeScale="24"
: xmpDM:startTimeSampleSize="1"
: xmpDM:tapeName=""
: xmpDM:altTapeName=""
: xmpDM:logComment=""
: xmpMM:InstanceID="xmp.iid:0480117407206811822AE6AAF5D55871"
: xmpMM:DocumentID="xmp.did:709C869A082068118083DD6390749A0C"
: xmpMM:OriginalDocumentID="xmp.did:709C869A082068118083DD6390749A0C">
: <xmpDM:videoFrameSize
: stDim:w="1280"
: stDim:h="720"
: stDim:unit="pixel"/>
: <xmpDM:duration
: xmpDM:value="2816"
: xmpDM:scale="1/1000"/>
: <xmpDM:startTimecode
: xmpDM:timeValue="00:00:00:00"
: xmpDM:timeFormat="24Timecode"/>
: <xmpDM:altTimecode
: xmpDM:timeValue="00:00:00:00"
: xmpDM:timeFormat="24Timecode"/>
: <xmpMM:History>
: <rdf:Seq>
: <rdf:li
: stEvt:action="saved"
: stEvt:instanceID="xmp.iid:719C869A082068118083DD6390749A0C"
: stEvt:when="2014-12-07T14:08:22-08:00"
: stEvt:softwareAgent="Adobe Premiere Pro CS6 (Macintosh)"
: stEvt:changed="/"/>
: <rdf:li
: stEvt:action="saved"
: stEvt:instanceID="xmp.iid:729C869A082068118083DD6390749A0C"
: stEvt:when="2014-12-07T14:08:23-08:00"
: stEvt:softwareAgent="Adobe Premiere Pro CS6 (Macintosh)"
: stEvt:changed="/metadata"/>
: <rdf:li
: stEvt:action="modified"
: stEvt:parameters="unknown modifications"/>
: <rdf:li
: stEvt:action="saved"
: stEvt:instanceID="xmp.iid:0180117407206811822AE6AAF5D55871"
: stEvt:when="2014-12-07T14:15:45-08:00"
: stEvt:softwareAgent="Adobe Premiere Pro CS6 (Macintosh)"
: stEvt:changed="/"/>
: <rdf:li
: stEvt:action="saved"
: stEvt:instanceID="xmp.iid:0280117407206811822AE6AAF5D55871"
: stEvt:when="2014-12-07T14:15:46-08:00"
: stEvt:softwareAgent="Adobe Premiere Pro CS6 (Macintosh)"
: stEvt:changed="/metadata"/>
: <rdf:li
: stEvt:action="saved"
: stEvt:instanceID="xmp.iid:0480117407206811822AE6AAF5D55871"
: stEvt:when="2014-12-07T14:19:26-08:00"
: stEvt:softwareAgent="Adobe Premiere Pro CS6 (Macintosh)"
: stEvt:changed="/metadata"/>
: </rdf:Seq>
: </xmpMM:History>
: </rdf:Description>
: </rdf:RDF>
: </x:xmpmeta>
:
:
:
:
:
:
:
:
:
: <?xpacket end="w"?>
encoder : Lavf56.4.101
Stream #0:0(eng): Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 12 fps, 12288 tbn, 12 tbc (default)
Metadata:
handler_name : Apple Alias Data Handler
encoder : Lavc56.1.100 libx264
Stream #0:1(eng): Audio: aac (libfaac) (mp4a / 0x6134706D), 44100 Hz, stereo, s16, 128 kb/s (default)
Metadata:
handler_name : Apple Alias Data Handler
encoder : Lavc56.1.100 libfaac
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (aac (native) -> aac (libfaac))
Press [q] to stop, [?] for help
frame= 45 fps=0.0 q=-1.0 Lsize= 504kB time=00:00:03.58 bitrate=1153.1kbits/s dup=1 drop=39
video:496kB audio:1kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.351465%
[libx264 @ 0x7fc189829a00] frame I:1 Avg QP:16.16 size: 19137
[libx264 @ 0x7fc189829a00] frame P:42 Avg QP:19.07 size: 11474
[libx264 @ 0x7fc189829a00] frame B:2 Avg QP:19.62 size: 3256
[libx264 @ 0x7fc189829a00] consecutive B-frames: 91.1% 8.9% 0.0% 0.0%
[libx264 @ 0x7fc189829a00] mb I I16..4: 39.3% 57.6% 3.1%
[libx264 @ 0x7fc189829a00] mb P I16..4: 10.8% 22.4% 0.4% P16..4: 36.1% 6.9% 2.4% 0.0% 0.0% skip:20.9%
[libx264 @ 0x7fc189829a00] mb B I16..4: 0.7% 2.1% 0.0% B16..8: 25.5% 2.5% 0.3% direct: 3.2% skip:65.8% L0:59.6% L1:36.8% BI: 3.6%
[libx264 @ 0x7fc189829a00] 8x8 transform intra:66.0% inter:89.9%
[libx264 @ 0x7fc189829a00] coded y,uvDC,uvAC intra: 30.7% 68.7% 5.3% inter: 12.0% 39.0% 0.2%
[libx264 @ 0x7fc189829a00] i16 v,h,dc,p: 33% 27% 18% 22%
[libx264 @ 0x7fc189829a00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 34% 25% 28% 2% 2% 2% 2% 2% 2%
[libx264 @ 0x7fc189829a00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 38% 23% 12% 4% 6% 6% 5% 4% 3%
[libx264 @ 0x7fc189829a00] i8c dc,h,v,p: 42% 25% 30% 4%
[libx264 @ 0x7fc189829a00] Weighted P-Frames: Y:7.1% UV:2.4%
[libx264 @ 0x7fc189829a00] ref P L0: 74.8% 5.4% 14.9% 4.7% 0.2%
[libx264 @ 0x7fc189829a00] ref B L0: 90.9% 9.1%
[libx264 @ 0x7fc189829a00] kb/s:1082.75
答案1
我改用 avconv,它更接近我想要的效果:
avconv -r 24 -i src.mov -an -vf fps=fps=12 output.mov