ffmpeg中的视频和音频拉伸计算

时间:2017-01-30 17:02:37

标签: shell ffmpeg

我正在ffmpeg上对视频和音频轨道进行一些极端慢动作,但不能完全正确地计算。

输入视频为00:06:41:00,24fps(9624帧)。 我需要输出视频为34:00:00:00,24fps(2937600帧)。

我尝试了这些视频和音频:

setpts=305.237*PTS

atempo=0.5, atempo=0.5, atempo=0.5, atempo=0.5, atempo=0.5, atempo=0.5, atempo=0.5, atempo=0.5, atempo=0.807668329177057

然而视频超过了00:01:19:08并且音频我不确定,在一个播放器上它会在8小时左右停止,但在另一个播放器上它会继续播放。什么是正确的公式?

同样在VLC上,视频在视频帧之间有灰色帧 - 我是否需要进行插值以获得连续的视频帧?

@Mulvya编辑:

fred-macbookpro:~ srederiquefantune$ ffmpeg -i /Users/srederiquefantune/Desktop/test.mp4 -filter_complex "[0:v]setpts=305.237*PTS, scale=320:240[v];[0:a]atempo=0.5, atempo=0.5, atempo=0.5, atempo=0.5, atempo=0.5, atempo=0.5, atempo=0.5, atempo=0.5, atempo=0.807668329177057[a]" -map "[v]" -map "[a]" /Users/srederiquefantune/Desktop/output2.mp4
ffmpeg version 3.2.2 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.2.1 (GCC) (Apple Inc. build 5666) (dot 3)
  configuration: --prefix=/opt/local --enable-swscale --enable-avfilter --enable-avresample --enable-libmp3lame --enable-libvorbis --enable-libopus --enable-libtheora --enable-libschroedinger --enable-libopenjpeg --enable-libmodplug --enable-libvpx --enable-libsoxr --enable-libspeex --enable-libass --enable-libbluray --enable-lzma --enable-gnutls --enable-fontconfig --enable-libfreetype --enable-libfribidi --disable-libxcb --disable-libxcb-shm --disable-libxcb-xfixes --disable-indev=jack --disable-outdev=xv --disable-audiotoolbox --disable-videotoolbox --disable-sdl2 --mandir=/opt/local/share/man --enable-shared --enable-pthreads --cc=/usr/bin/gcc-4.2 --disable-filter=coreimage --disable-filter=coreimagesrc --enable-vda --disable-indev=avfoundation --arch=x86_64 --enable-yasm --enable-libx265 --enable-gpl --enable-postproc --enable-libx264 --enable-libxvid
  libavutil      55. 34.100 / 55. 34.100
  libavcodec     57. 64.101 / 57. 64.101
  libavformat    57. 56.100 / 57. 56.100
  libavdevice    57.  1.100 / 57.  1.100
  libavfilter     6. 65.100 /  6. 65.100
  libavresample   3.  1.  0 /  3.  1.  0
  libswscale      4.  2.100 /  4.  2.100
  libswresample   2.  3.100 /  2.  3.100
  libpostproc    54.  1.100 / 54.  1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/srederiquefantune/Desktop/test.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
  Duration: 00:06:41.25, start: 0.000000, bitrate: 2294 kb/s
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 2172 kb/s, 24 fps, 120 tbr, 90k tbn, 48 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 112 kb/s (default)
    Metadata:
      handler_name    : VideoHandler
[libx264 @ 0x104801200] using SAR=4/3
[libx264 @ 0x104801200] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.1 Cache64
[libx264 @ 0x104801200] profile High, level 1.3
[libx264 @ 0x104801200] 264 - core 148 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - 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=3 lookahead_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=24 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, mp4, to '/Users/srederiquefantune/Desktop/output2.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.56.100
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 320x240 [SAR 4:3 DAR 16:9], q=-1--1, 24 fps, 12288 tbn, 24 tbc (default)
    Metadata:
      encoder         : Lavc57.64.101 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1: Audio: aac (LC) ([64][0][0][0] / 0x0040), 44100 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      encoder         : Lavc57.64.101 aac
Stream mapping:
  Stream #0:0 (h264) -> setpts
  Stream #0:1 (aac) -> atempo
  scale -> Stream #0:0 (libx264)
  atempo -> Stream #0:1 (aac)
Press [q] to stop, [?] for help
[output stream 0:1 @ 0x104105420] 100 buffers queued in output stream 0:1, something may be wrong.
frame=    1 fps=0.0 q=0.0 size=       3kB time=00:00:22.01 bitrate=   1.2kbits/s
…
frame=2938515 fps=281 q=-1.0 Lsize= 2439310kB time=35:19:08.66 bitrate= 157.2kbits/s dup=2928888 drop=1 speed=12.1x    
video:389302kB audio:1994106kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2.345466%
[libx264 @ 0x104801200] frame I:15399 Avg QP:14.27  size: 20680
[libx264 @ 0x104801200] frame P:740673 Avg QP:17.21  size:    68
[libx264 @ 0x104801200] frame B:2182443 Avg QP:25.83  size:    14
[libx264 @ 0x104801200] consecutive B-frames:  0.9%  0.2%  0.1% 98.8%
[libx264 @ 0x104801200] mb I  I16..4:  7.9% 47.3% 44.8%
[libx264 @ 0x104801200] mb P  I16..4:  0.0%  0.1%  0.1%  P16..4:  0.7%  0.1%  0.1%  0.0%  0.0%    skip:99.0%
[libx264 @ 0x104801200] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  0.1%  0.0%  0.0%  direct: 0.0%  skip:99.9%  L0:14.0% L1:85.9% BI: 0.0%
[libx264 @ 0x104801200] 8x8 transform intra:48.2% inter:52.8%
[libx264 @ 0x104801200] coded y,uvDC,uvAC intra: 91.4% 90.7% 88.0% inter: 0.1% 0.1% 0.0%
[libx264 @ 0x104801200] i16 v,h,dc,p: 78%  4% 11%  7%
[libx264 @ 0x104801200] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 18% 13% 17%  7%  8% 10%  7% 10% 10%
[libx264 @ 0x104801200] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 19% 13% 11%  8% 10% 11%  8% 10%  9%
[libx264 @ 0x104801200] i8c dc,h,v,p: 62% 15% 16%  7%
[libx264 @ 0x104801200] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x104801200] ref P L0: 87.6%  7.8%  4.0%  0.6%  0.0%
[libx264 @ 0x104801200] ref B L0: 50.0% 49.6%  0.4%
[libx264 @ 0x104801200] ref B L1: 91.3%  8.7%
[libx264 @ 0x104801200] kb/s:26.05
[aac @ 0x104802a00] Qavg: 632.499
fred-macbookpro:~ srederiquefantune$ 

0 个答案:

没有答案