[FFmpeg-user] Frame accurate cropping

Tobias Rapp t.rapp at noa-archive.com
Wed Oct 7 12:19:08 CEST 2015


On 06.10.2015 11:12, Soner CAN wrote:
> [...]
>
> 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?
>

If you use "-c:v copy" I assume the video will only be cut at GOP 
borders. So if you do not have an intra-frame video file you have to 
re-encode the file with "-c:v libx264 ..." to get frame-exact range 
extraction.

Regards,
Tobias



More information about the ffmpeg-user mailing list