[FFmpeg-user] What is the correct way to cut the video with ffmpeg?

桃源老師 xanadu6291 at dream.jp
Tue Jun 21 14:45:36 CEST 2016


> 2016/06/21 8:52 P.M. Carl Eugen Hoyos <cehoyos<at>ag.or.at> wrote:
> 
> 桃源老師 <xanadu6291 <at> dream.jp> writes:
>> 
>> So this is the answer for my question right?
>> 
>> Since my video is h264, it can be cut at non key frame even though 
>> I use "-codec copy".  right?
> 
> No, I just wanted to explain that valid h264 videos without 
> key frame exist, and that it should be possible to cut them.

OK I understand.

> I cannot answer your original question, you have not even 
> shown complete, uncut console output (it is always required 
> if you need help here), nor provided an example input file.

I uploaded a sample video to the following URL:

http://www.mediafire.com/download/gx2h7p3kl6axwr9/sample.mp4.zip

Command line is:

$ ffmpeg -ss 00:00:30.666 -i sample.mp4 -ss 0 -c: copy test3.mp4
ffmpeg version N-79554-g9a6ae7f Copyright (c) 2000-2016 the FFmpeg developers
  built with Apple LLVM version 7.3.0 (clang-703.0.29)
  configuration: --prefix=/Volumes/ffmpeg_compile --pkg-config-flags=--static --disable-ffserver --enable-gpl --enable-version3 --enable-nonfree --enable-libmp3lame --enable-libfdk-aac --enable-libvo-amrwbenc --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvorbis --enable-libspeex --enable-libopus --enable-libgsm --enable-libtwolame --enable-libsoxr --enable-libwavpack --enable-libmodplug --enable-libopenjpeg --enable-libwebp --enable-libtheora --enable-libx264 --enable-libopenh264 --enable-libx265 --enable-libxvid --enable-libvpx --enable-libxavs --enable-libfreetype --enable-fontconfig --enable-libfribidi --enable-libass --enable-libbluray --enable-libvidstab --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libzmq
  libavutil      55. 22.101 / 55. 22.101
  libavcodec     57. 35.100 / 57. 35.100
  libavformat    57. 34.103 / 57. 34.103
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 44.100 /  6. 44.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
[h264 @ 0x104810a00] Increasing reorder buffer to 1
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'sample.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.34.103
  Duration: 00:00:42.04, start: 0.000000, bitrate: 1527 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 856x480 [SAR 1:1 DAR 107:60], 1394 kb/s, 29.97 fps, 29.97 tbr, 60k tbn (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 125 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
[mp4 @ 0x1038d3c00] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
    Last message repeated 1 times
Output #0, mp4, to 'test3.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.34.103
    Stream #0:0(und): Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 856x480 [SAR 1:1 DAR 107:60], q=2-31, 1394 kb/s, 29.97 fps, 29.97 tbr, 60k tbn (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, 125 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=  260 fps=0.0 q=-1.0 Lsize=    1468kB time=00:00:11.33 bitrate=1060.7kbits/s speed= 574x    
video:1285kB audio:174kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.693997%

> (And I am not sure if I understood your original question, was 
> it "I have a correctly looking output video but I expected it 
> to be broken"?)

Sorry for my poor English.
I don't expect the video would be broken.  
In other word, my question is if the resulting video is fine, is it correct to 
cut video on not key frame?


Best Regards,


// Miya aka. TougenRoushi

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3577 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-user/attachments/20160621/651ac197/attachment.bin>


More information about the ffmpeg-user mailing list