加速/放慢视频ffmpeg

时间:2017-07-15 09:06:03

标签: ffmpeg

我想使用ffmpeg框架更改视频速度。我用这个命令:

ffmpeg -y -i /storage/extSdCard/Video/1.avi -filter_complex [0:v]fps=50.0, setpts=0.5*PTS[v];[0:a]atempo=2.0[a] -map [v] -map [a] -preset ultrafast /storage/emulated/0/VID-20170716-VidRotate1.mp4

如何在减慢或加快视频速度后猜测结果视频的持续时间?

这是我的整个登录控制台:

ffmpeg -y -i /storage/extSdCard/Video/1.avi -filter_complex [0:v]fps=50.0, setpts=0.5*PTS[v];[0:a]atempo=2.0[a] -map [v] -map [a] -preset ultrafast /storage/emulated/0/VID-20170716-VidRotate1.mp4 
    07-16 15:07:15.112: ffmpeg version n3.0.1 Copyright (c) 2000-2016 the FFmpeg developers
    07-16 15:07:15.112:   built with gcc 4.8 (GCC)
    07-16 15:07:15.112:   configuration: --target-os=linux --cross-prefix=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi- --arch=arm --cpu=cortex-a8 --enable-runtime-cpudetect --sysroot=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/sysroot --enable-pic --enable-libx264 --enable-libass --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-fontconfig --enable-pthreads --disable-debug --disable-ffserver --enable-version3 --enable-hardcoded-tables --disable-ffplay --disable-ffprobe --enable-gpl --enable-yasm --disable-doc --disable-shared --enable-static --pkg-config=/home/vagrant/SourceCode/ffmpeg-android/ffmpeg-pkg-config --prefix=/home/vagrant/SourceCode/ffmpeg-android/build/armeabi-v7a --extra-cflags='-I/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all' --extra-ldflags='-L/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/lib -Wl,-z,relro -Wl,-z,now -pie' --extra-libs='-lpng -lexpat -lm' --extra-cxxflags=
    07-16 15:07:15.122:   libavutil      55. 17.103 / 55. 17.103
    07-16 15:07:15.122:   libavcodec     57. 24.102 / 57. 24.102
    07-16 15:07:15.122:   libavformat    57. 25.100 / 57. 25.100
    07-16 15:07:15.132:   libavdevice    57.  0.101 / 57.  0.101
    07-16 15:07:15.132:   libavfilter     6. 31.100 /  6. 31.100
    07-16 15:07:15.132:   libswscale      4.  0.100 /  4.  0.100
    07-16 15:07:15.132:   libswresample   2.  0.101 /  2.  0.101
    07-16 15:07:15.142:   libpostproc    54.  0.100 / 54.  0.100
    07-16 15:07:15.232: Input #0, avi, from '/storage/extSdCard/Video/1.avi':
    07-16 15:07:15.232:   Metadata:
    07-16 15:07:15.232:     encoder         : Lavf52.104.0
    07-16 15:07:15.232:   Duration: 00:02:03.96, start: 0.000000, bitrate: 773 kb/s
    07-16 15:07:15.242:     Stream #0:0: Video: mpeg4 (Simple Profile) (xvid / 0x64697678), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 632 kb/s, 25 fps, 25 tbr, 25 tbn, 25 tbc
    07-16 15:07:15.242:     Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 44100 Hz, stereo, s16p, 128 kb/s
    07-16 15:07:15.262 750-781/? W/ActivityManager: mDVFSHelper.release()
    07-16 15:07:15.282: [libx264 @ 0xb5428800] using SAR=1/1
    07-16 15:07:15.312: [libx264 @ 0xb5428800] using cpu capabilities: none!
    07-16 15:07:15.422: [libx264 @ 0xb5428800] profile Constrained Baseline, level 3.1
    07-16 15:07:15.422: [libx264 @ 0xb5428800] 264 - core 148 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=0 intra_refresh=0 rc=crf mbtree=0 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=0
    07-16 15:07:15.462: Output #0, mp4, to '/storage/emulated/0/VID-20170716-VidRotate1.mp4':
    07-16 15:07:15.462:   Metadata:
    07-16 15:07:15.462:     encoder         : Lavf57.25.100
    07-16 15:07:15.462:     Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 640x480 [SAR 1:1 DAR 4:3], q=-1--1, 50 fps, 12800 tbn, 50 tbc (default)
    07-16 15:07:15.462:     Metadata:
    07-16 15:07:15.462:       encoder         : Lavc57.24.102 libx264
    07-16 15:07:15.462:     Side data:
    07-16 15:07:15.462:       unknown side data type 10 (24 bytes)
    07-16 15:07:15.472:     Stream #0:1: Audio: aac (LC) ([64][0][0][0] / 0x0040), 44100 Hz, stereo, fltp, 128 kb/s (default)
    07-16 15:07:15.472:     Metadata:
    07-16 15:07:15.472:       encoder         : Lavc57.24.102 aac
    07-16 15:07:15.472: Stream mapping:
    07-16 15:07:15.472:   Stream #0:0 (mpeg4) -> fps
    07-16 15:07:15.472:   Stream #0:1 (mp3) -> atempo
    07-16 15:07:15.472:   setpts -> Stream #0:0 (libx264)
    07-16 15:07:15.472:   atempo -> Stream #0:1 (aac)
    07-16 15:07:15.472: Press [q] to stop, [?] for help
    07-16 15:07:15.532: Past duration 0.999992 too large
    07-16 15:07:15.972: frame=   24 fps=0.0 q=15.0 size=      62kB time=00:00:00.39 bitrate=1296.2kbits/s dup=0 drop=19 speed=0.781x    
    07-16 15:07:16.483: frame=   45 fps= 44 q=15.0 size=      63kB time=00:00:00.83 bitrate= 617.2kbits/s dup=0 drop=40 speed=0.827x    
    07-16 15:07:16.983: frame=   72 fps= 48 q=20.0 size=     104kB time=00:00:01.36 bitrate= 621.9kbits/s dup=0 drop=67 speed=0.906x    
    07-16 15:07:17.484: frame=   99 fps= 49 q=17.0 size=     171kB time=00:00:01.90 bitrate= 734.8kbits/s dup=0 drop=94 speed=0.942x    
    07-16 15:07:18.004: frame=  125 fps= 49 q=22.0 size=     208kB time=00:00:02.41 bitrate= 704.8kbits/s dup=0 drop=120 speed=0.953x    
    07-16 15:07:18.515: frame=  152 fps= 50 q=18.0 size=     334kB time=00:00:02.97 bitrate= 919.6kbits/s dup=0 drop=147 speed=0.979x    
    07-16 15:07:19.015: frame=  181 fps= 51 q=18.0 size=     407kB time=00:00:03.55 bitrate= 938.9kbits/s dup=0 drop=176 speed=   1x    
    07-16 15:07:19.516: frame=  209 fps= 52 q=16.0 size=     465kB time=00:00:04.13 bitrate= 921.3kbits/s dup=0 drop=204 speed=1.02x    
    07-16 15:07:20.026: frame=  234 fps= 51 q=15.0 size=     483kB time=00:00:04.59 bitrate= 860.0kbits/s dup=0 drop=229 speed=1.01x    
    07-16 15:07:20.527: frame=  258 fps= 51 q=20.0 size=     606kB time=00:00:05.08 bitrate= 975.7kbits/s dup=0 drop=253 speed=1.01x    
    07-16 15:07:21.047: frame=  291 fps= 52 q=15.0 size=     606kB time=00:00:05.73 bitrate= 866.0kbits/s dup=0 drop=286 speed=1.03x    
    07-16 15:07:21.558: frame=  317 fps= 52 q=23.0 size=     716kB time=00:00:06.24 bitrate= 938.8kbits/s dup=0 drop=312 speed=1.03x    
    07-16 15:07:22.048: frame=  342 fps= 52 q=17.0 size=     781kB time=00:00:06.75 bitrate= 947.1kbits/s dup=0 drop=337 speed=1.03x    
    07-16 15:07:22.549: frame=  367 fps= 52 q=20.0 size=     823kB time=00:00:07.26 bitrate= 927.7kbits/s dup=0 drop=362 speed=1.03x    
    07-16 15:07:23.049: frame=  393 fps= 52 q=19.0 size=     903kB time=00:00:07.77 bitrate= 951.0kbits/s dup=0 drop=388 speed=1.03x    
    07-16 15:07:23.560: frame=  421 fps= 52 q=17.0 size=     992kB time=00:00:08.33 bitrate= 974.6kbits/s dup=0 drop=416 speed=1.03x    
    07-16 15:07:24.060: frame=  448 fps= 52 q=15.0 size=    1016kB time=00:00:08.87 bitrate= 938.7kbits/s dup=0 drop=443 speed=1.03x    
    07-16 15:07:24.551: frame=  474 fps= 52 q=15.0 size=    1029kB time=00:00:09.40 bitrate= 896.0kbits/s dup=0 drop=469 speed=1.04x    
    07-16 15:07:25.061: frame=  500 fps= 52 q=15.0 size=    1029kB time=00:00:09.91 bitrate= 850.1kbits/s dup=0 drop=495 speed=1.03x    
    07-16 15:07:25.562: frame=  528 fps= 52 q=15.0 size=    1110kB time=00:00:10.49 bitrate= 866.8kbits/s dup=0 drop=523 speed=1.04x    
    07-16 15:07:26.052: frame=  560 fps= 53 q=15.0 size=    1114kB time=00:00:11.12 bitrate= 820.6kbits/s dup=0 drop=555 speed=1.05x    
    07-16 15:07:26.563: frame=  591 fps= 53 q=15.0 size=    1117kB time=00:00:11.74 bitrate= 779.1kbits/s dup=0 drop=586 speed=1.06x    
    07-16 15:07:27.063: frame=  621 fps= 54 q=18.0 size=    1154kB time=00:00:12.35 bitrate= 765.2kbits/s dup=0 drop=616 speed=1.07x    
    07-16 15:07:27.574: frame=  648 fps= 54 q=20.0 size=    1200kB time=00:00:12.91 bitrate= 761.2kbits/s dup=0 drop=643 speed=1.07x    
    07-16 15:07:28.084: frame=  675 fps= 54 q=20.0 size=    1292kB time=00:00:13.42 bitrate= 788.6kbits/s dup=0 drop=670 speed=1.06x    
    07-16 15:07:28.585: frame=  701 fps= 53 q=16.0 size=    1346kB time=00:00:13.95 bitrate= 790.4kbits/s dup=0 drop=696 speed=1.06x    
    07-16 15:07:29.085: frame=  729 fps= 54 q=15.0 size=    1380kB time=00:00:14.48 bitrate= 780.0kbits/s dup=0 drop=724 speed=1.06x    
    07-16 15:07:29.616: frame=  753 fps= 53 q=12.0 size=    1380kB time=00:00:15.00 bitrate= 753.6kbits/s dup=0 drop=748 speed=1.06x    
    07-16 15:07:30.116: frame=  780 fps= 53 q=15.0 size=    1459kB time=00:00:15.51 bitrate= 770.4kbits/s dup=0 drop=775 speed=1.06x    
    07-16 15:07:30.627: frame=  812 fps= 54 q=15.0 size=    1464kB time=00:00:16.16 bitrate= 742.1kbits/s dup=0 drop=807 speed=1.07x    
    07-16 15:07:31.127: frame=  843 fps= 54 q=15.0 size=    1465kB time=00:00:16.78 bitrate= 715.0kbits/s dup=0 drop=838 speed=1.07x    
    07-16 15:07:31.638: frame=  875 fps= 54 q=15.0 size=    1469kB time=00:00:17.41 bitrate= 691.0kbits/s dup=0 drop=870 speed=1.08x    
    07-16 15:07:32.138: frame=  906 fps= 54 q=18.0 size=    1507kB time=00:00:18.04 bitrate= 684.1kbits/s dup=0 drop=901 speed=1.08x    
    07-16 15:07:32.649: frame=  932 fps= 54 q=21.0 size=    1555kB time=00:00:18.55 bitrate= 686.8kbits/s dup=0 drop=927 speed=1.08x    
    07-16 15:07:33.159: frame=  960 fps= 54 q=23.0 size=    1614kB time=00:00:19.13 bitrate= 691.1kbits/s dup=0 drop=955 speed=1.08x    
    07-16 15:07:33.670: frame=  988 fps= 54 q=20.0 size=    1737kB time=00:00:19.66 bitrate= 723.7kbits/s dup=0 drop=983 speed=1.08x    
    07-16 15:07:34.180: frame= 1014 fps= 54 q=16.0 size=    1876kB time=00:00:20.22 bitrate= 759.9kbits/s dup=0 drop=1009 speed=1.08x    
    07-16 15:07:34.671: frame= 1042 fps= 54 q=15.0 size=    1897kB time=00:00:20.75 bitrate= 748.6kbits/s dup=0 drop=1037 speed=1.08x    
    07-16 15:07:35.181: frame= 1069 fps= 54 q=15.0 size=    1911kB time=00:00:21.29 bitrate= 735.3kbits/s dup=0 drop=1064 speed=1.08x    
    07-16 15:07:35.692: frame= 1098 fps= 54 q=15.0 size=    1912kB time=00:00:21.89 bitrate= 715.2kbits/s dup=0 drop=1093 speed=1.08x    
    07-16 15:07:36.182: frame= 1126 fps= 54 q=15.0 size=    1918kB time=00:00:22.43 bitrate= 700.3kbits/s dup=0 drop=1121 speed=1.08x    
    07-16 15:07:36.703: frame= 1154 fps= 54 q=15.0 size=    1918kB time=00:00:23.01 bitrate= 682.8kbits/s dup=0 drop=1149 speed=1.08x    
    07-16 15:07:37.203: frame= 1182 fps= 54 q=15.0 size=    1952kB time=00:00:23.56 bitrate= 678.4kbits/s dup=0 drop=1177 speed=1.08x    
    07-16 15:07:37.724: frame= 1212 fps= 54 q=21.0 size=    1990kB time=00:00:24.19 bitrate= 673.6kbits/s dup=0 drop=1207 speed=1.09x    
    07-16 15:07:38.224: frame= 1240 fps= 55 q=20.0 size=    2085kB time=00:00:24.72 bitrate= 690.5kbits/s dup=0 drop=1235 speed=1.09x    
    07-16 15:07:38.725: frame= 1267 fps= 54 q=16.0 size=    2227kB time=00:00:25.28 bitrate= 721.3kbits/s dup=0 drop=1262 speed=1.09x    
    07-16 15:07:39.235: frame= 1296 fps= 55 q=15.0 size=    2266kB time=00:00:25.86 bitrate= 717.8kbits/s dup=0 drop=1291 speed=1.09x    
    07-16 15:07:39.736: frame= 1321 fps= 54 q=15.0 size=    2279kB time=00:00:26.35 bitrate= 708.3kbits/s dup=0 drop=1316 speed=1.09x    
    07-16 15:07:40.236: frame= 1348 fps= 54 q=15.0 size=    2279kB time=00:00:26.91 bitrate= 693.8kbits/s dup=0 drop=1343 speed=1.09x    
    07-16 15:07:40.747: frame= 1375 fps= 54 q=15.0 size=    2288kB time=00:00:27.42 bitrate= 683.6kbits/s dup=0 drop=1370 speed=1.09x    
    07-16 15:07:41.237: frame= 1402 fps= 54 q=15.0 size=    2289kB time=00:00:27.95 bitrate= 670.6kbits/s dup=0 drop=1397 speed=1.08x    
    07-16 15:07:41.768: frame= 1430 fps= 54 q=15.0 size=    2294kB time=00:00:28.53 bitrate= 658.4kbits/s dup=0 drop=1425 speed=1.09x    
    07-16 15:07:42.278: frame= 1456 fps= 54 q=22.0 size=    2296kB time=00:00:29.04 bitrate= 647.4kbits/s dup=0 drop=1451 speed=1.08x    
    07-16 15:07:42.779: frame= 1485 fps= 54 q=21.0 size=    2350kB time=00:00:29.62 bitrate= 649.6kbits/s dup=0 drop=1480 speed=1.09x    
    07-16 15:07:43.279: frame= 1512 fps= 54 q=20.0 size=    2492kB time=00:00:30.16 bitrate= 676.9kbits/s dup=0 drop=1507 speed=1.08x    
    07-16 15:07:43.790: frame= 1539 fps= 54 q=16.0 size=    2562kB time=00:00:30.72 bitrate= 683.1kbits/s dup=0 drop=1534 speed=1.09x    
    07-16 15:07:44.290: frame= 1566 fps= 54 q=15.0 size=    2581kB time=00:00:31.25 bitrate= 676.4kbits/s dup=0 drop=1561 speed=1.08x    
    07-16 15:07:44.801: frame= 1592 fps= 54 q=15.0 size=    2581kB time=00:00:31.76 bitrate= 665.7kbits/s dup=0 drop=1587 speed=1.08x    
    07-16 15:07:45.301: frame= 1619 fps= 54 q=15.0 size=    2589kB time=00:00:32.29 bitrate= 656.5kbits/s dup=0 drop=1614 speed=1.08x    
    07-16 15:07:45.802: frame= 1646 fps= 54 q=15.0 size=    2589kB time=00:00:32.83 bitrate= 646.0kbits/s dup=0 drop=1641 speed=1.08x    
    07-16 15:07:46.332: frame= 1672 fps= 54 q=15.0 size=    2593kB time=00:00:33.39 bitrate= 636.2kbits/s dup=0 drop=1667 speed=1.08x    
    07-16 15:07:46.823: frame= 1698 fps= 54 q=15.0 size=    2594kB time=00:00:33.87 bitrate= 627.2kbits/s dup=0 drop=1693 speed=1.08x    
    07-16 15:07:47.333: frame= 1724 fps= 54 q=15.0 size=    2597kB time=00:00:34.43 bitrate= 617.9kbits/s dup=0 drop=1719 speed=1.08x    
    07-16 15:07:47.844: frame= 1748 fps= 54 q=17.0 size=    2661kB time=00:00:34.89 bitrate= 624.7kbits/s dup=0 drop=1743 speed=1.08x    
    07-16 15:07:48.344: frame= 1775 fps= 54 q=22.0 size=    2731kB time=00:00:35.43 bitrate= 631.4kbits/s dup=0 drop=1770 speed=1.08x    
    07-16 15:07:48.865: frame= 1800 fps= 54 q=19.0 size=    2867kB time=00:00:35.92 bitrate= 653.8kbits/s dup=0 drop=1795 speed=1.08x    
    07-16 15:07:49.375: frame= 1826 fps= 54 q=17.0 size=    2968kB time=00:00:36.43 bitrate= 667.3kbits/s dup=0 drop=1821 speed=1.07x    
    07-16 15:07:49.876: frame= 1854 fps= 54 q=15.0 size=    3014kB time=00:00:36.98 bitrate= 667.5kbits/s dup=0 drop=1849 speed=1.08x    
    07-16 15:07:50.366: frame= 1878 fps= 54 q=15.0 size=    3041kB time=00:00:37.47 bitrate= 664.7kbits/s dup=0 drop=1873 speed=1.07x    
    07-16 15:07:50.877: frame= 1904 fps= 54 q=15.0 size=    3052kB time=00:00:38.01 bitrate= 657.7kbits/s dup=0 drop=1899 speed=1.07x    
    07-16 15:07:51.387: frame= 1929 fps= 54 q=15.0 size=    3056kB time=00:00:38.49 bitrate= 650.3kbits/s dup=0 drop=1924 speed=1.07x    
    07-16 15:07:51.888: frame= 1955 fps= 54 q=17.0 size=    3060kB time=00:00:39.03 bitrate= 642.2kbits/s dup=0 drop=1950 speed=1.07x    
    07-16 15:07:52.388: frame= 1981 fps= 54 q=17.0 size=    3062kB time=00:00:39.54 bitrate= 634.3kbits/s dup=0 drop=1976 speed=1.07x    
    07-16 15:07:52.899: frame= 2007 fps= 54 q=25.0 size=    3064kB time=00:00:40.07 bitrate= 626.4kbits/s dup=0 drop=2002 speed=1.07x    
    07-16 15:07:53.419: frame= 2036 fps= 54 q=20.0 size=    3255kB time=00:00:40.63 bitrate= 656.1kbits/s dup=0 drop=2031 speed=1.07x    
    07-16 15:07:53.920: frame= 2061 fps= 54 q=21.0 size=    3306kB time=00:00:41.14 bitrate= 658.2kbits/s dup=0 drop=2056 speed=1.07x    
    07-16 15:07:54.420: frame= 2089 fps= 54 q=17.0 size=    3371kB time=00:00:41.70 bitrate= 662.2kbits/s dup=0 drop=2084 speed=1.07x    
    07-16 15:07:54.910: frame= 2116 fps= 54 q=15.0 size=    3438kB time=00:00:42.23 bitrate= 666.8kbits/s dup=0 drop=2111 speed=1.07x    
    07-16 15:07:55.421: frame= 2139 fps= 54 q=15.0 size=    3460kB time=00:00:42.70 bitrate= 663.7kbits/s dup=0 drop=2134 speed=1.07x    
    07-16 15:07:55.921: frame= 2164 fps= 53 q=15.0 size=    3467kB time=00:00:43.21 bitrate= 657.2kbits/s dup=0 drop=2159 speed=1.07x    
    07-16 15:07:56.422: frame= 2189 fps= 53 q=15.0 size=    3470kB time=00:00:43.69 bitrate= 650.6kbits/s dup=0 drop=2184 speed=1.07x    
    07-16 15:07:56.932: frame= 2214 fps= 53 q=15.0 size=    3472kB time=00:00:44.21 bitrate= 643.4kbits/s dup=0 drop=2209 speed=1.07x    
    07-16 15:07:57.433: frame= 2235 fps= 53 q=15.0 size=    3474kB time=00:00:44.60 bitrate= 637.9kbits/s dup=0 drop=2230 speed=1.06x    
    07-16 15:07:57.943: frame= 2260 fps= 53 q=16.0 size=    3547kB time=00:00:45.13 bitrate= 643.7kbits/s dup=0 drop=2255 speed=1.06x    
    07-16 15:07:58.454: frame= 2292 fps= 53 q=24.0 size=    3555kB time=00:00:45.76 bitrate= 636.3kbits/s dup=0 drop=2287 speed=1.06x    
    07-16 15:07:58.964: frame= 2320 fps= 53 q=21.0 size=    3643kB time=00:00:46.34 bitrate= 643.9kbits/s dup=0 drop=2315 speed=1.07x    
    07-16 15:07:59.475: frame= 2348 fps= 53 q=16.0 size=    3700kB time=00:00:46.88 bitrate= 646.6kbits/s dup=0 drop=2343 speed=1.07x    
    07-16 15:07:59.985: frame= 2375 fps= 53 q=22.0 size=    3755kB time=00:00:47.43 bitrate= 648.5kbits/s dup=0 drop=2370 speed=1.07x    
    07-16 15:08:00.486: frame= 2400 fps= 53 q=22.0 size=    3880kB time=00:00:47.92 bitrate= 663.3kbits/s dup=0 drop=2395 speed=1.06x    
    07-16 15:08:00.996: frame= 2427 fps= 53 q=15.0 size=    3977kB time=00:00:48.46 bitrate= 672.2kbits/s dup=0 drop=2422 speed=1.06x    
    07-16 15:08:01.497: frame= 2456 fps= 53 q=18.0 size=    4012kB time=00:00:49.06 bitrate= 669.9kbits/s dup=0 drop=2451 speed=1.07x    
    07-16 15:08:01.997: frame= 2481 fps= 53 q=16.0 size=    4029kB time=00:00:49.55 bitrate= 666.1kbits/s dup=0 drop=2476 speed=1.06x    
    07-16 15:08:02.498: frame= 2507 fps= 53 q=20.0 size=    4036kB time=00:00:50.06 bitrate= 660.4kbits/s dup=0 drop=2502 speed=1.06x    
    07-16 15:08:03.008: frame= 2538 fps= 53 q=15.0 size=    4113kB time=00:00:50.68 bitrate= 664.7kbits/s dup=0 drop=2533 speed=1.07x    
    07-16 15:08:03.529: frame= 2568 fps= 53 q=22.0 size=    4132kB time=00:00:51.26 bitrate= 660.2kbits/s dup=0 drop=2563 speed=1.07x    
    07-16 15:08:04.039: frame= 2596 fps= 53 q=22.0 size=    4184kB time=00:00:51.85 bitrate= 661.1kbits/s dup=0 drop=2591 speed=1.07x    
    07-16 15:08:04.560: frame= 2623 fps= 53 q=23.0 size=    4276kB time=00:00:52.40 bitrate= 668.4kbits/s dup=0 drop=2618 speed=1.07x    
    07-16 15:08:05.060: frame= 2647 fps= 53 q=16.0 size=    4379kB time=00:00:52.87 bitrate= 678.5kbits/s dup=0 drop=2642 speed=1.07x    
    07-16 15:08:05.571: frame= 2671 fps= 53 q=19.0 size=    4425kB time=00:00:53.33 bitrate= 679.6kbits/s dup=0 drop=2666 speed=1.06x    
    07-16 15:08:06.071: frame= 2696 fps= 53 q=15.0 size=    4452kB time=00:00:53.87 bitrate= 677.0kbits/s dup=0 drop=2691 speed=1.06x    
    07-16 15:08:06.582: frame= 2723 fps= 53 q=15.0 size=    4478kB time=00:00:54.38 bitrate= 674.5kbits/s dup=0 drop=2718 speed=1.06x    
    07-16 15:08:07.102: frame= 2750 fps= 53 q=15.0 size=    4479kB time=00:00:54.91 bitrate= 668.1kbits/s dup=0 drop=2745 speed=1.06x    
    07-16 15:08:07.593: frame= 2779 fps= 53 q=15.0 size=    4558kB time=00:00:55.49 bitrate= 672.8kbits/s dup=0 drop=2774 speed=1.06x    
    07-16 15:08:08.093: frame= 2810 fps= 53 q=16.0 size=    4560kB time=00:00:56.12 bitrate= 665.5kbits/s dup=0 drop=2805 speed=1.07x    
    07-16 15:08:08.594: frame= 2841 fps= 53 q=21.0 size=    4565kB time=00:00:56.74 bitrate= 658.9kbits/s dup=0 drop=2836 speed=1.07x    
    07-16 15:08:09.104: frame= 2871 fps= 54 q=21.0 size=    4616kB time=00:00:57.33 bitrate= 659.5kbits/s dup=0 drop=2866 speed=1.07x    
    07-16 15:08:09.615: frame= 2897 fps= 54 q=22.0 size=    4673kB time=00:00:57.88 bitrate= 661.3kbits/s dup=0 drop=2892 speed=1.07x    
    07-16 15:08:10.115: frame= 2925 fps= 54 q=16.0 size=    4779kB time=00:00:58.42 bitrate= 670.1kbits/s dup=0 drop=2920 speed=1.07x    
    07-16 15:08:10.616: frame= 2951 fps= 54 q=15.0 size=    4817kB time=00:00:58.95 bitrate= 669.4kbits/s dup=0 drop=2946 speed=1.07x    
    07-16 15:08:11.146: frame= 2978 fps= 54 q=15.0 size=    4851kB time=00:00:59.51 bitrate= 667.8kbits/s dup=0 drop=2973 speed=1.07x    
    07-16 15:08:11.667: frame= 3007 fps= 54 q=21.0 size=    4852kB time=00:01:00.04 bitrate= 661.9kbits/s dup=0 drop=3002 speed=1.07x    
    07-16 15:08:12.157: frame= 3037 fps= 54 q=15.0 size=    4933kB time=00:01:00.65 bitrate= 666.3kbits/s dup=0 drop=3032 speed=1.07x    
    07-16 15:08:12.648: frame= 3069 fps= 54 q=15.0 size=    4939kB time=00:01:01.30 bitrate= 660.0kbits/s dup=0 drop=3064 speed=1.07x    
    07-16 15:08:13.148: frame= 3101 fps= 54 q=15.0 size=    4939kB time=00:01:01.88 bitrate= 653.9kbits/s dup=0 drop=3096 speed=1.07x    
    07-16 15:08:13.238: frame= 3101 fps= 54 q=-1.0 Lsize=    4994kB time=00:01:02.02 bitrate= 659.6kbits/s dup=0 drop=3096 speed=1.07x    
    07-16 15:08:13.238: video:4923kB audio:16kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.108781%
    07-16 15:08:13.248: [libx264 @ 0xb5428800] frame I:13    Avg QP:14.15  size: 72152
    07-16 15:08:13.248: [libx264 @ 0xb5428800] frame P:3088  Avg QP:17.25  size:  1329
    07-16 15:08:13.248: [libx264 @ 0xb5428800] mb I  I16..4: 100.0%  0.0%  0.0%
    07-16 15:08:13.248: [libx264 @ 0xb5428800] mb P  I16..4:  0.8%  0.0%  0.0%  P16..4:  7.0%  0.0%  0.0%  0.0%  0.0%    skip:92.2%
    07-16 15:08:13.248: [libx264 @ 0xb5428800] coded y,uvDC,uvAC intra: 49.6% 59.6% 45.8% inter: 2.5% 4.8% 1.9%
    07-16 15:08:13.248: [libx264 @ 0xb5428800] i16 v,h,dc,p: 50% 26% 13% 10%
    07-16 15:08:13.248: [libx264 @ 0xb5428800] i8c dc,h,v,p: 45% 24% 21% 10%
    07-16 15:08:13.248: [libx264 @ 0xb5428800] kb/s:650.25
    07-16 15:08:13.258: [aac @ 0xb5429000] Qavg: 65536.000

3 个答案:

答案 0 :(得分:4)

如果您将每个时间戳(演示文稿时间戳,PTS)更改为其原始值的一半,则您的视频将缩短一半。

因此,如果PTS为x * PTS,则您的最终持续时间为x * duration

示例:

$ ffprobe -loglevel error input.mp4 -show_format -show_entries format=duration -of compact=p=0:nk=1
60.000000
$ ffmpeg -i input.mp4 -filter:v 'setpts=0.5*PTS' -filter:a 'atempo=2' output.mp4
...
$ ffprobe -loglevel error output.mp4 -show_format -show_entries format=duration -of compact=p=0:nk=1
30.050000

答案 1 :(得分:1)

我最近才面对这个问题。为我自己做了一个ffmpeg cli包装。 src可以来自:https://github.com/gadominas/autocut

基本上是放慢/加速视频和放大你需要执行的音频:

autocut -f tempo -i your_video_file.ext -t 120

您也可以将功能与自动切换相结合,如:

autocut -f mkv2mp4,tempo,fade -i your_video_file.mkv -t 80 -h 20

将mkv转换为mp4,将视频速度降低到原始速度的80%并应用fadein&从乞讨到20帧的淡出端。

答案 2 :(得分:0)

我使用此命令以半速(例如更多的低音)音频来减慢视频

ffmpeg -i videoplayback.mp4  -filter_complex "[0:v]setpts=2*PTS[v];[0:a]atempo=0.5[a];[0:a]asetrate=44100*0.5,aresample=44100" -map "[v]" -map "[a]" output.mp4

请注意ffmpeg专业版,但是那里的许多命令都会对音频进行重新采样,因此不会更深