rand
rand

Reputation: 698

ffmpeg "select" filter not working with MPEG-4 and "-vcodec copy"

I have an MPEG-4 video, which mediainfo describes as:

Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom
Overall bit rate                         : 6 772 Kbps
Writing application                      : Lavf54.6.100

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : [email protected]
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 4 frames
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Bit rate                                 : 25.0 Mbps
Frame rate mode                          : Constant
Frame rate                               : 29.000 fps
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.554
Stream size                              : 500 MiB (98%)
Writing library                          : x264 core 125
Encoding settings                        : cabac=1 / ref=3 / deblock=1:0:0 /     nalyse=0x3:0x113 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=12 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=abr / mbtree=1 / bitrate=25000 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00

(I removed some useless information)

What I'd like to do is remove the first, say, 200 frames from the video.

However, if I try with ffmpeg (version 0.11.1, compiled from source)

ffmpeg -i video.mp4 -vf select='gte(n\,200)' -vcodec copy -strict -2 out.mp4

it doesn't work, the frames are exactly the same. If I remove the -vcodec copy part, what happens is that the first 190 frames are all the same (equal to the 190th one); so, they're not removed, but replaced with the 190th one.

If I try the select filter to extract single images from the video, with

ffmpeg -i video.mp4 -vf "select=gte(n\,200)" %d.jpg

it works alright.

Does anybody have an idea why this happens?

Thank you!

Upvotes: 1

Views: 2409

Answers (1)

llogan
llogan

Reputation: 133873

You can not stream copy with -vcodec copy and use video filters at the same time. You must re-encode if you want to perform filtering.

If you want to stream copy the first 200 frames:

ffmpeg -i input -frames:v 200 -codec copy output.mkv

Upvotes: 2

Related Questions