[FFmpeg-user] ct a video precisly

Robert Krüger krueger at lesspain.de
Wed Sep 16 12:15:15 CEST 2015


On Wed, Sep 16, 2015 at 11:33 AM, <gagall at free.fr> wrote:

> Hello,
>
> I'm trying to cut a video to get 12s sequences. It needs to be accurate.
> But when I ask a 12 seconds sequence (not from the begining for this
> example) , I get around 12:01 seconds.
> The command line is :
> ffmpeg -ss 00:00:00.00 -i GOPR0151.mp4 -b:v 30150 -t 00:00:12.00 -acodec
> copy -vcodec copy GOPR0151_002.mp4
>
> and even, when I start from 00:02:12.00, the output lasts 12:33 seconds.
>
> Can anybody tell me who to get more accuracy, please ?
> I noticed that the bitrate is not the same in the orginal video than in
> the output. Is it important ?
> Here are the informations of the original video :
> ffprobe.exe GOPR0151.mp4
> ffprobe version N-74751-gb54e03c Copyright (c) 2007-2015 the FFmpeg
> developers
>   built with gcc 4.9.3 (GCC)
>   configuration: --enable-gpl --enable-version3 --disable-w32threads
> --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r
> --enable-gnu
> tls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b
> --enable-libcaca --enable-libdcadec --enable-libfreetype --enable-libgme
> --enab
> le-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame
> --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg
> --enable
> -libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr
> --enable-libspeex --enable-libtheora --enable-libtwolame
> --enable-libvidstab --ena
> ble-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis
> --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264
> --enable-libx265 --e
> nable-libxavs --enable-libxvid --enable-lzma --enable-decklink
> --enable-zlib
>   libavutil      54. 31.100 / 54. 31.100
>   libavcodec     56. 59.100 / 56. 59.100
>   libavformat    56. 40.101 / 56. 40.101
>   libavdevice    56.  4.100 / 56.  4.100
>   libavfilter     5. 40.100 /  5. 40.100
>   libswscale      3.  1.101 /  3.  1.101
>   libswresample   1.  2.101 /  1.  2.101
>   libpostproc    53.  3.100 / 53.  3.100
> Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'GOPR0151.mp4':
>   Metadata:
>     major_brand     : avc1
>     minor_version   : 0
>     compatible_brands: avc1isom
>     creation_time   : 2014-10-25 09:19:36
>   Duration: 00:17:24.30, start: 0.000000, bitrate: 30150 kb/s
>     Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc,
> bt709), 1280x960 [SAR 1:1 DAR 4:3], 30002 kb/s, 100 fps, 100 tbr, 180k tbn,
>  200 tbc (default)
>     Metadata:
>       creation_time   : 2014-10-25 09:19:36
>       handler_name    :  GoPro AVC
>       encoder         : GoPro AVC encoder
>     Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz,
> stereo, fltp, 128 kb/s (default)
>     Metadata:
>       creation_time   : 2014-10-25 09:19:36
>       handler_name    :  GoPro AAC
>
>
> And the output :
> ffprobe.exe GOPR0151_002.mp4
> ffprobe version N-74751-gb54e03c Copyright (c) 2007-2015 the FFmpeg
> developers
>   built with gcc 4.9.3 (GCC)
>   configuration: --enable-gpl --enable-version3 --disable-w32threads
> --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r
> --enable-gnu
> tls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b
> --enable-libcaca --enable-libdcadec --enable-libfreetype --enable-libgme
> --enab
> le-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame
> --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg
> --enable
> -libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr
> --enable-libspeex --enable-libtheora --enable-libtwolame
> --enable-libvidstab --ena
> ble-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis
> --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264
> --enable-libx265 --e
> nable-libxavs --enable-libxvid --enable-lzma --enable-decklink
> --enable-zlib
>   libavutil      54. 31.100 / 54. 31.100
>   libavcodec     56. 59.100 / 56. 59.100
>   libavformat    56. 40.101 / 56. 40.101
>   libavdevice    56.  4.100 / 56.  4.100
>   libavfilter     5. 40.100 /  5. 40.100
>   libswscale      3.  1.101 /  3.  1.101
>   libswresample   1.  2.101 /  1.  2.101
>   libpostproc    53.  3.100 / 53.  3.100
> Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'GOPR0151_002.mp4':
>   Metadata:
>     major_brand     : isom
>     minor_version   : 512
>     compatible_brands: isomiso2avc1mp41
>     encoder         : Lavf56.40.101
>   Duration: 00:00:12.33, start: 0.309333, bitrate: 30273 kb/s
>     Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc,
> bt709), 1280x960 [SAR 1:1 DAR 4:3], 30187 kb/s, 100 fps, 100 tbr, 180k tbn,
>  200 tbc (default)
>     Metadata:
>       handler_name    : VideoHandler
>     Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz,
> stereo, fltp, 128 kb/s (default)
>     Metadata:
>       handler_name    : SoundHandler
>
>
> Thanks in advance
>
> Fridu
> _______________________________________________
>

What you try will not work, i.e. accurately cut subclips out of a video
containing non-i-frames (which your gopro content certainly does) without
re-encoding (-acodec/-vcodec copy). You will need to re-encode your video
(probably with libx264) to get accurate edits and live with the quality
loss.


More information about the ffmpeg-user mailing list