[FFmpeg-user] Frame accurate cropping

Soner CAN soner2 at gmail.com
Tue Oct 6 11:12:11 CEST 2015


I have a video. Here is it's ffprobe output:

> ffprobe 7347-00009\ kliksa.mp4
ffprobe version 2.6.1 Copyright (c) 2007-2015 the FFmpeg developers
  built with Apple LLVM version 6.1.0 (clang-602.0.49) (based on LLVM 3.6.0svn)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/2.6.1
--enable-shared --enable-pthreads --enable-gpl --enable-version3
--enable-hardcoded-tables --enable-avresample --cc=clang
--host-cflags= --host-ldflags= --enable-libx264 --enable-libmp3lame
--enable-libvo-aacenc --enable-libxvid --enable-libfreetype
--enable-libvorbis --enable-libvpx --enable-libass --enable-ffplay
--enable-libfdk-aac --enable-libopus --enable-libquvi --enable-libx265
--enable-nonfree --enable-vda
  libavutil      54. 20.100 / 54. 20.100
  libavcodec     56. 26.100 / 56. 26.100
  libavformat    56. 25.101 / 56. 25.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 11.102 /  5. 11.102
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '7347-00009 kliksa.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: avc1isommp42
    creation_time   : 2015-09-17 14:04:14
  Duration: 00:00:30.44, start: 0.000000, bitrate: 7238 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p,
1920x1080 [SAR 1:1 DAR 16:9], 6977 kb/s, 25 fps, 25 tbr, 90k tbn, 50
tbc (default)
    Metadata:
      creation_time   : 2015-09-17 14:04:14
      handler_name    : ?Apple Video Media Handler
      encoder         : inegy Cinecoder H.264 Encoder
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz,
stereo, fltp, 255 kb/s (default)
    Metadata:
      creation_time   : 2015-09-17 14:04:14
      handler_name    : ?Apple Sound Media Handler

All players show that it's duration is 30 seconds. But it's EXACT duration
is 00:00:30.44 as ffprobe shows.

What I want to do is setting the videos duration to EXACTLY 00:00:30.00.

I tried this:

ffmpeg -i 7347-00009\ kliksa.mp4 -c copy -ss 00:00:00.000 -to 30.000 test.mp4

But I still have a duration of 00:00:30.02. Here is ffprobe output:

> ffprobe test.mp4
ffprobe version 2.6.1 Copyright (c) 2007-2015 the FFmpeg developers
  built with Apple LLVM version 6.1.0 (clang-602.0.49) (based on LLVM 3.6.0svn)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/2.6.1
--enable-shared --enable-pthreads --enable-gpl --enable-version3
--enable-hardcoded-tables --enable-avresample --cc=clang
--host-cflags= --host-ldflags= --enable-libx264 --enable-libmp3lame
--enable-libvo-aacenc --enable-libxvid --enable-libfreetype
--enable-libvorbis --enable-libvpx --enable-libass --enable-ffplay
--enable-libfdk-aac --enable-libopus --enable-libquvi --enable-libx265
--enable-nonfree --enable-vda
  libavutil      54. 20.100 / 54. 20.100
  libavcodec     56. 26.100 / 56. 26.100
  libavformat    56. 25.101 / 56. 25.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 11.102 /  5. 11.102
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.25.101
  Duration: 00:00:30.02, start: 0.000000, bitrate: 7240 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p,
1920x1080 [SAR 1:1 DAR 16:9], 6982 kb/s, 25 fps, 25 tbr, 90k tbn, 50
tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz,
stereo, fltp, 255 kb/s (default)
    Metadata:
      handler_name    : SoundHandler

So, how can I have a video cut frame accurately?


More information about the ffmpeg-user mailing list