Jump to content

Cutting with ffmpeg. Bad results.


tomnjerry74

Recommended Posts

tomnjerry74

I have an mkv I made directly from MakeMKV. I'm trying to just cut off the first minute or so with ffmpeg and keep getting unusable results.

This is the source video:

ID                                       : 1
ID in the original source medium         : 4113 (0x1011)
Format                                   : VC-1
Format profile                           : Advanced@L3
Codec ID                                 : V_MS/VFW/FOURCC / WVC1
Codec ID/Hint                            : Microsoft
Duration                                 : 52 min 22 s
Bit rate                                 : 30.0 Mb/s
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 23.976 (24000/1001) FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Compression mode                         : Lossy
Bits/(Pixel*Frame)                       : 0.604
Stream size                              : 11.0 GiB (90%)
Language                                 : English
Default                                  : No
Forced                                   : No
Original source medium                   : Blu-ray

And this is the command I'm using:

ffmpeg -fflags +genpts -i st.mkv -ss 00:01:05 -c copy -map 0 output.mkv

And here's the output:

ID                                       : 1
ID in the original source medium         : 4113 (0x1011)
Format                                   : VC-1
Format profile                           : Advanced@L3
Codec ID                                 : V_MS/VFW/FOURCC / WVC1
Codec ID/Hint                            : Microsoft
Duration                                 : 51 min 17 s
Bit rate                                 : 30.0 Mb/s
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Variable
Frame rate                               : 24.482 FPS
Original frame rate                      : 23.976 (24000/1001) FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Compression mode                         : Lossy
Bits/(Pixel*Frame)                       : 0.591
Stream size                              : 11.0 GiB (91%)
Language                                 : English
Default                                  : Yes
Forced                                   : No
Original source medium                   : Blu-ray

 

As you can see, it increases the framerate to variable 24.482, a seemingly random value... (If I stop the conversion mid-way through, the framerate is even larger in the hundreds.)

I've tried forcing it with -r and other commands to keep it constant and they don't help.

Anyway, I think this is messing up the output because if I seek through the video in VLC or MPV, it looks like this for about a second before fixing itself:

image.thumb.png.3afc855401d2ea2a18b254d2bfff083a.png

When I perform the same cut with MKVToolNix the output is perfectly fine.

This should probably be asked on a different forum, but maybe someone here has had a similar experience due to the nature of the files I'm working with?

Edited by tomnjerry74
Link to comment
Share on other sites

tomnjerry74

I think it's because it's not cutting on a keyframe maybe?

Edited by tomnjerry74
Link to comment
Share on other sites

tomnjerry74

More commands I've now tried (with same results):

-start_at_zero -copyts
-noaccurate_seek
-avoid_negative_ts make_zero

and moving around the -ss and -to
Link to comment
Share on other sites

tomnjerry74
42 minutes ago, Luke said:

I would suggest doing this with mkvtoolnix instead.

Yeah I'm realizing this is my best bet. Looks like ffmpeg isn't that great at automatically cutting at the nearest keyframe without reencoding.

Just ended up doing:

mkvmerge -o done.mkv --split timestamps:00:01:05.000 st.mkv

Nice, simple command that works perfectly.

Thanks

Link to comment
Share on other sites

rbjtech

always do -ss FIRST for ffmpeg but ffmpeg is not a great authoring tool tbh - If mkvmerge works, then I would stick to that.

ie - using your example.

Quote
ffmpeg -ss 00:01:05 -fflags +genpts -i st.mkv -c copy -map 0 output.mkv

 

Edited by rbjtech
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...