VideoHelp Forum

Try DVDFab and download streaming video, copy, convert or make Blu-rays,DVDs! Download free trial !
+ Reply to Thread
Results 1 to 6 of 6
Thread
  1. I need to cut off 3 seconds from the end of video and keep all subtitle streams, but it does not work.

    video length: 1:33:34

    Code:
    ffmpeg -ss 0:00:00 -t 1:33:31 -i 111.mp4 -c copy 1111.mp4
    ffmpeg -ss 0:00:00 -t 1:33:31 -i 111.mp4 -map 0:s -c copy 1111.mp4
    Quote Quote  
  2. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    FFmpeg is accurate when it comes to cutting videos but you have to understand its method. You get a different result if you specify your -ss and -t before the video name or after it. You will get the closest results if you specify both after the -i video. This is because FFMpeg must cut on a Key frame or 'I' frame. If you ask it to start somewhere in between 'I' frames it will start there but usually gives a static frame until it meets a new key frame.

    Close Method
    Code:
    ffmpeg -i 111.mp4 -ss 0 -t 1:33:31 -c copy 1111.mp4
    FFmpeg can also use total seconds:
    Code:
    ffmpeg -i 111.mp4 -ss 0 -t 5611 -c copy 1111.mp4
    You can get even closer if you specify the number of frames:
    Code:
    ffmpeg -i 111.mp4 -ss 0 -vframes <xxxxxxxxx> -c copy 1111.mp4
    If you specify time BEFORE the -i video, ffmpeg will seek to the key frame BEFORE the start point. If you specify time AFTER the -i video, it will seek to the Key Frame AFTER the cut point. It also likes to end on a non- 'B' Frame so your end point may not be exact. If you use the -vframes method FFMpeg will throw a 'P' frame at the end if needed as close as it can to your cut point.
    Quote Quote  
  3. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    Notice in the example below, the end cut is made 1 frames in front of the 'P' frame 14176 because FFMpeg usually requires 1 frame to stop.

    Code:
    ffmpeg -ss 0.000000 -i "C:\Users\Bud\Desktop\cgop.mp4" -vframes 14176 -c:v copy -c:a copy -y "C:\Users\Bud\Desktop\3_0_cgop.mp4"
    The above string will cut from time 0.000000 through 447.985342 exactly

    Image
    [Attachment 54283 - Click to enlarge]
    Quote Quote  
  4. Hi Budman1,

    Perhaps I did not express myself clearly.

    This method cuts video exactly as it should(3 seconds form the end) but does not keep subtitle streams.
    Code:
    ffmpeg -ss 0:00:00 -t 1:33:31 -i 111.mp4 -c copy 1111.mp4

    What you suggest...
    Code:
    ffmpeg -i 111.mp4 -ss 0 -t 1:33:31 -c copy 1111.mp4
    ...does not work , it cuts 3 seconds of video from the beginning, audio is playing and removes subtitles.


    My problem is not the cut itself, but how to convince ffmpeg not to remove subtitles.
    Quote Quote  
  5. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    Make sure you have latest ffmpeg and then:
    FFMpeg -i 111.mp4 -ss 0 -t 1:33:31 -c copy -map 0:0 -map 0:1 -map 0:2 1111.mp4

    Works for me here.
    Quote Quote  
  6. The problem was with the older version of ffmpeg, the new one works well.
    Quote Quote  



Similar Threads