I'm trying to trim the first second off some .y4m videos.

Using the answer provided here, I am able to trim the first second off a .mp4 video and then play back the output video:

ffmpeg -ss 1 -i input.mp4 -vcodec copy -acodec copy output.mp4

When I try to use the same command with a .y4m video, however, I get the following error and the file that is output is blank:

ffmpeg -ss 1 -i input.y4m -vcodec copy -acodec copy output.y4m

yuv4mpegpipe @ 0x5628e3af63c0] ERROR: Codec not supported.
Could not write header for output file #0 (incorrect codec parameters ?): Invalid data found when processing input

Why is this command not working with a .y4m file? Do I need to add additional parameters? Is there another way to trim the first second off a .y4m video?


Due to a change in the Y4M muxer, you'll need to re-encode, but this is a lossless op.

ffmpeg -ss 1 -i input.y4m output.y4m

Y4Ms can't have any audio, so audio codec option removed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.