[FFmpeg-user] Decimating video frames to shorten movie

Rae, Philip John prae at lanl.gov
Sun Jul 3 23:28:24 CEST 2016


I am new to ffmpeg and I have a question about ‘decimating’ movies to remove unwanted frames. I have a high speed movie with too many frames (too little motion between frames) that I want to remove 4 in 5 frames (for instance) and resave the shorter one (fewer frames and a shorter duration movie).

I thought the following would work after some research

ffmpeg -y -i Test_too_slow.avi -filter:v "select='not(mod(n\,5))'” out.avi

but it keeps the duration of the movie the same as the input rather than a fifth as long and it appears to do this by repeating frames. This is obviously not what I want. The original had 700 frames and played at 12 fps. 700/5 is 140. Indeed looking at the output below, the number of processed frames is 141, however, the duration is still 58 seconds rather than 11.6.

I have tried playing with the -r and -framerate options, but this appeared to do nothing useful in this case.

I also tried post processing the output

ffmpeg -i out.avi -filter:v "setpts=0.2*PTS" out2.avi

but that worked poorly since the movie became very jumpy as if the extraction did not rip out evenly spaced extra dummy frames installed by the previous operation but a variable frame each few cycles.


I am sure there is a simple fix, but it escapes me at the moment.


Many thanks

Philip

ffmpeg -y -i Test_too_slow.avi -filter:v "select='not(mod(n\,5))'" out.avi
ffmpeg version 3.1.1-tessus Copyright (c) 2000-2016 the FFmpeg developers
  built with Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
  configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --as=yasm --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libass --enable-libbluray --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzmq --enable-version3 --disable-ffplay --disable-indev=qtkit --disable-indev=x11grab_xcb
  libavutil      55. 28.100 / 55. 28.100
  libavcodec     57. 48.101 / 57. 48.101
  libavformat    57. 41.100 / 57. 41.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 47.100 /  6. 47.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
Input #0, avi, from 'Test_too_slow.avi':
  Duration: 00:00:58.27, start: 0.000000, bitrate: 138830 kb/s
    Stream #0:0: Video: rawvideo, bgr24, 800x600, 138993 kb/s, 12.05 fps, 12.05 tbr, 12.05 tbn, 12.05 tbc
[avi @ 0x7fc38a00fc00] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
Output #0, avi, to 'out.avi':
  Metadata:
    ISFT            : Lavf57.41.100
    Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 800x600, q=2-31, 200 kb/s, 12.05 fps, 12.05 tbn, 12.05 tbc
    Metadata:
      encoder         : Lavc57.48.101 mpeg4
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> mpeg4 (native))
Press [q] to stop, [?] for help
frame=  141 fps=0.0 q=4.5 Lsize=     956kB time=00:00:58.18 bitrate= 134.5kbits/s speed= 134x
video:934kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2.362345%









"You are entitled to your own opinion, but you are not entitled to your own facts.", Daniel Patrick Moynihan (1927-2003)

************************************
Philip Rae
PO Box 1663, MS-J564
Los Alamos
NM 87545
Tel:- 505 667 4436
Fax:- 505 667 9809
e-mail:- prae at lanl.gov<mailto:prae at lanl.gov>
************************************








More information about the ffmpeg-user mailing list