[FFmpeg-user] cutting mts(h264+ac3) with least possible transcoding

Moritz Barsnick barsnick at gmx.net
Wed Jul 17 18:43:46 EEST 2019


On Wed, Jul 17, 2019 at 17:20:24 +0200, Henning Thielemann wrote:
> I tried this:
>
> $ ffmpeg -ss 00:02 -i 00078.MTS -vcodec copy -acodec ac3 -b:a 256k cut.mts
>
> However, cut.mts contains only audio, no video anymore:
>
> $ ffmpeg -i cut.mts

Usually, the output from the conversion command is much more
interesting than only the inspection of the output.

> Input #0, mpegts, from '/tmp/cut.mts':
>    Duration: 00:00:04.26, start: 1.400000, bitrate: 297 kb/s
>    Program 1
>      Metadata:
>        service_name    : Service01
>        service_provider: FFmpeg
>      Stream #0:0[0x100]: Video: h264 ([27][0][0][0] / 0x001B), none, 90k tbr, 90k tbn, 180k tbc
>      Stream #0:1[0x101]: Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, stereo, fltp, 256 kb/s

The output does contain video and audio, according to this!

Had you shown us the conversion command, we would have seen that 0
video frames are being copied:

> frame=    0 fps=0.0 q=-1.0 Lsize=N/A time=00:00:00.00 bitrate=N/A speed=   0x
> video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

I believe this may be due to your seek command "-ss 00:02". ffmpeg
cannot find any keyframes starting from your given offset, and
therefore can't begin the output stream, and produces 0 output frames.

If you use the output option "-copyinkf", ffmpeg will copy the initial
non-keyframes and actually produce 218 output frames. The output will
probably be of little use without a single keyframe though.

I guess this means you can't cut this video at this point with the copy
codec. You need to reencode.

> ffmpeg version 2.8.15-0ubuntu0.16.04.1 Copyright (c) 2000-2018 the FFmpeg developers

BTW, this is a very old version. That isn't the cause of your issue,
but using a newer (newest!) version before reporting issues is
recommended here. You can grab static binaries from here:
https://johnvansickle.com/ffmpeg/

Cheers,
Moritz


More information about the ffmpeg-user mailing list