ffmpeg trying to remove the first few seconds of video












3















I'm trying to remove a few seconds off the front of a video stream (audio already excluded), and I'm getting strange results: I would think that for every second I increase -ss by, the resulting file would be a second shorter... that doesn't seem to be the case.



original     ==> 01:04:52.84
-ss 19 ==> 01:04:42.84 (diff = 10) [command history shown below]
-ss 20 ==> 01:04:32.84 (diff = 20) [command history shown below]
-ss 21 ==> 01:04:32.84 (diff = 20)
-ss 25 ==> 01:04:32.84 (diff = 20)
-ss 0:0:25.0 ==> 01:04:32.84 (diff = 20)
-ss 0:0:25.5 ==> 01:04:32.84 (diff = 20) [command history shown below]


Command: ffmpeg -ss # -i temp.mp4 -y -vcodec copy temp_croppedFromStart.mp4



Here's the command history for 19 & 20



# ffmpeg -ss 19 -i temp.mp4 -y -vcodec copy  temp_croppedFromStart.mp4; ffmpeg -i temp.mp4 2>&1 | grep Duration; ffmpeg -i temp_croppedFromStart.mp4 2>&1 | grep Duration
ffmpeg version N-31809-g9acffed, Copyright (c) 2000-2011 the FFmpeg developers
built on Aug 10 2011 21:25:11 with gcc 4.4.5
configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-x11grab
libavutil 51. 11. 1 / 51. 11. 1
libavcodec 53. 10. 0 / 53. 10. 0
libavformat 53. 6. 0 / 53. 6. 0
libavdevice 53. 2. 0 / 53. 2. 0
libavfilter 2. 28. 1 / 2. 28. 1
libswscale 2. 0. 0 / 2. 0. 0
libpostproc 51. 2. 0 / 51. 2. 0
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'temp.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 1970-01-01 00:00:00
encoder : Lavf53.6.0
Duration: 01:04:52.84, start: 0.000000, bitrate: 553 kb/s
Stream #0.0(und): Video: h264 (Constrained Baseline), yuv420p, 960x640, 552 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc
Metadata:
creation_time : 1970-01-01 00:00:00
Output #0, mp4, to 'temp_croppedFromStart.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 1970-01-01 00:00:00
encoder : Lavf53.6.0
Stream #0.0(und): Video: libx264, yuv420p, 960x640, q=2-31, 552 kb/s, 25 tbn, 25 tbc
Metadata:
creation_time : 1970-01-01 00:00:00
Stream mapping:
Stream #0.0 -> #0.0
Press [q] to stop, [?] for help
frame=97071 fps=42523 q=-1.0 Lsize= 262684kB time=01:04:33.84 bitrate= 555.5kbits/s
video:261923kB audio:0kB global headers:0kB muxing overhead 0.290418%
Duration: 01:04:52.84, start: 0.000000, bitrate: 553 kb/s
Duration: 01:04:42.84, start: 0.000000, bitrate: 554 kb/s


# ffmpeg -ss 20 -i temp.mp4 -y -vcodec copy temp_croppedFromStart.mp4; ffmpeg -i temp.mp4 2>&1 | grep Duration; ffmpeg -i temp_croppedFromStart.mp4 2>&1 | grep Duration
ffmpeg version N-31809-g9acffed, Copyright (c) 2000-2011 the FFmpeg developers
built on Aug 10 2011 21:25:11 with gcc 4.4.5
configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-x11grab
libavutil 51. 11. 1 / 51. 11. 1
libavcodec 53. 10. 0 / 53. 10. 0
libavformat 53. 6. 0 / 53. 6. 0
libavdevice 53. 2. 0 / 53. 2. 0
libavfilter 2. 28. 1 / 2. 28. 1
libswscale 2. 0. 0 / 2. 0. 0
libpostproc 51. 2. 0 / 51. 2. 0
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'temp.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 1970-01-01 00:00:00
encoder : Lavf53.6.0
Duration: 01:04:52.84, start: 0.000000, bitrate: 553 kb/s
Stream #0.0(und): Video: h264 (Constrained Baseline), yuv420p, 960x640, 552 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc
Metadata:
creation_time : 1970-01-01 00:00:00
Output #0, mp4, to 'temp_croppedFromStart.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 1970-01-01 00:00:00
encoder : Lavf53.6.0
Stream #0.0(und): Video: libx264, yuv420p, 960x640, q=2-31, 552 kb/s, 25 tbn, 25 tbc
Metadata:
creation_time : 1970-01-01 00:00:00
Stream mapping:
Stream #0.0 -> #0.0
Press [q] to stop, [?] for help
frame=96821 fps=47168 q=-1.0 Lsize= 262003kB time=01:04:32.84 bitrate= 554.2kbits/s
video:261244kB audio:0kB global headers:0kB muxing overhead 0.290410%
Duration: 01:04:52.84, start: 0.000000, bitrate: 553 kb/s
Duration: 01:04:32.84, start: 0.000000, bitrate: 554 kb/s

# ffmpeg -ss 0:0:25.5 -i temp.mp4 -y -vcodec copy temp_croppedFromStart.mp4; ffmpeg -i temp.mp4 2>&1 | grep Duration; ffmpeg -i temp_croppedFromStart.mp4 2>&1 | grep Duration
ffmpeg version N-31809-g9acffed, Copyright (c) 2000-2011 the FFmpeg developers
built on Aug 10 2011 21:25:11 with gcc 4.4.5
configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-x11grab
libavutil 51. 11. 1 / 51. 11. 1
libavcodec 53. 10. 0 / 53. 10. 0
libavformat 53. 6. 0 / 53. 6. 0
libavdevice 53. 2. 0 / 53. 2. 0
libavfilter 2. 28. 1 / 2. 28. 1
libswscale 2. 0. 0 / 2. 0. 0
libpostproc 51. 2. 0 / 51. 2. 0
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'temp.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 1970-01-01 00:00:00
encoder : Lavf53.6.0
Duration: 01:04:52.84, start: 0.000000, bitrate: 553 kb/s
Stream #0.0(und): Video: h264 (Constrained Baseline), yuv420p, 960x640, 552 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc
Metadata:
creation_time : 1970-01-01 00:00:00
Output #0, mp4, to 'temp_croppedFromStart.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 1970-01-01 00:00:00
encoder : Lavf53.6.0
Stream #0.0(und): Video: libx264, yuv420p, 960x640, q=2-31, 552 kb/s, 25 tbn, 25 tbc
Metadata:
creation_time : 1970-01-01 00:00:00
Stream mapping:
Stream #0.0 -> #0.0
Press [q] to stop, [?] for help
frame=96821 fps=45920 q=-1.0 Lsize= 262003kB time=01:04:27.32 bitrate= 555.0kbits/s
video:261244kB audio:0kB global headers:0kB muxing overhead 0.290424%
Duration: 01:04:52.84, start: 0.000000, bitrate: 553 kb/s
Duration: 01:04:32.84, start: 0.000000, bitrate: 554 kb/s









share|improve this question























  • I tried your line, C:>ffmpeg -ss # -i temp.mp4 -y -vcodec copy temp_croppedFromStart.mp4 and it worked with my mp4 here's a good one to test it on youtube.com/watch?v=c1kTgHJ_RHo maybe your video codec is funny, not well supported or something, try changing it to something else maybe, and report back

    – barlop
    Sep 18 '11 at 19:07


















3















I'm trying to remove a few seconds off the front of a video stream (audio already excluded), and I'm getting strange results: I would think that for every second I increase -ss by, the resulting file would be a second shorter... that doesn't seem to be the case.



original     ==> 01:04:52.84
-ss 19 ==> 01:04:42.84 (diff = 10) [command history shown below]
-ss 20 ==> 01:04:32.84 (diff = 20) [command history shown below]
-ss 21 ==> 01:04:32.84 (diff = 20)
-ss 25 ==> 01:04:32.84 (diff = 20)
-ss 0:0:25.0 ==> 01:04:32.84 (diff = 20)
-ss 0:0:25.5 ==> 01:04:32.84 (diff = 20) [command history shown below]


Command: ffmpeg -ss # -i temp.mp4 -y -vcodec copy temp_croppedFromStart.mp4



Here's the command history for 19 & 20



# ffmpeg -ss 19 -i temp.mp4 -y -vcodec copy  temp_croppedFromStart.mp4; ffmpeg -i temp.mp4 2>&1 | grep Duration; ffmpeg -i temp_croppedFromStart.mp4 2>&1 | grep Duration
ffmpeg version N-31809-g9acffed, Copyright (c) 2000-2011 the FFmpeg developers
built on Aug 10 2011 21:25:11 with gcc 4.4.5
configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-x11grab
libavutil 51. 11. 1 / 51. 11. 1
libavcodec 53. 10. 0 / 53. 10. 0
libavformat 53. 6. 0 / 53. 6. 0
libavdevice 53. 2. 0 / 53. 2. 0
libavfilter 2. 28. 1 / 2. 28. 1
libswscale 2. 0. 0 / 2. 0. 0
libpostproc 51. 2. 0 / 51. 2. 0
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'temp.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 1970-01-01 00:00:00
encoder : Lavf53.6.0
Duration: 01:04:52.84, start: 0.000000, bitrate: 553 kb/s
Stream #0.0(und): Video: h264 (Constrained Baseline), yuv420p, 960x640, 552 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc
Metadata:
creation_time : 1970-01-01 00:00:00
Output #0, mp4, to 'temp_croppedFromStart.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 1970-01-01 00:00:00
encoder : Lavf53.6.0
Stream #0.0(und): Video: libx264, yuv420p, 960x640, q=2-31, 552 kb/s, 25 tbn, 25 tbc
Metadata:
creation_time : 1970-01-01 00:00:00
Stream mapping:
Stream #0.0 -> #0.0
Press [q] to stop, [?] for help
frame=97071 fps=42523 q=-1.0 Lsize= 262684kB time=01:04:33.84 bitrate= 555.5kbits/s
video:261923kB audio:0kB global headers:0kB muxing overhead 0.290418%
Duration: 01:04:52.84, start: 0.000000, bitrate: 553 kb/s
Duration: 01:04:42.84, start: 0.000000, bitrate: 554 kb/s


# ffmpeg -ss 20 -i temp.mp4 -y -vcodec copy temp_croppedFromStart.mp4; ffmpeg -i temp.mp4 2>&1 | grep Duration; ffmpeg -i temp_croppedFromStart.mp4 2>&1 | grep Duration
ffmpeg version N-31809-g9acffed, Copyright (c) 2000-2011 the FFmpeg developers
built on Aug 10 2011 21:25:11 with gcc 4.4.5
configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-x11grab
libavutil 51. 11. 1 / 51. 11. 1
libavcodec 53. 10. 0 / 53. 10. 0
libavformat 53. 6. 0 / 53. 6. 0
libavdevice 53. 2. 0 / 53. 2. 0
libavfilter 2. 28. 1 / 2. 28. 1
libswscale 2. 0. 0 / 2. 0. 0
libpostproc 51. 2. 0 / 51. 2. 0
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'temp.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 1970-01-01 00:00:00
encoder : Lavf53.6.0
Duration: 01:04:52.84, start: 0.000000, bitrate: 553 kb/s
Stream #0.0(und): Video: h264 (Constrained Baseline), yuv420p, 960x640, 552 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc
Metadata:
creation_time : 1970-01-01 00:00:00
Output #0, mp4, to 'temp_croppedFromStart.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 1970-01-01 00:00:00
encoder : Lavf53.6.0
Stream #0.0(und): Video: libx264, yuv420p, 960x640, q=2-31, 552 kb/s, 25 tbn, 25 tbc
Metadata:
creation_time : 1970-01-01 00:00:00
Stream mapping:
Stream #0.0 -> #0.0
Press [q] to stop, [?] for help
frame=96821 fps=47168 q=-1.0 Lsize= 262003kB time=01:04:32.84 bitrate= 554.2kbits/s
video:261244kB audio:0kB global headers:0kB muxing overhead 0.290410%
Duration: 01:04:52.84, start: 0.000000, bitrate: 553 kb/s
Duration: 01:04:32.84, start: 0.000000, bitrate: 554 kb/s

# ffmpeg -ss 0:0:25.5 -i temp.mp4 -y -vcodec copy temp_croppedFromStart.mp4; ffmpeg -i temp.mp4 2>&1 | grep Duration; ffmpeg -i temp_croppedFromStart.mp4 2>&1 | grep Duration
ffmpeg version N-31809-g9acffed, Copyright (c) 2000-2011 the FFmpeg developers
built on Aug 10 2011 21:25:11 with gcc 4.4.5
configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-x11grab
libavutil 51. 11. 1 / 51. 11. 1
libavcodec 53. 10. 0 / 53. 10. 0
libavformat 53. 6. 0 / 53. 6. 0
libavdevice 53. 2. 0 / 53. 2. 0
libavfilter 2. 28. 1 / 2. 28. 1
libswscale 2. 0. 0 / 2. 0. 0
libpostproc 51. 2. 0 / 51. 2. 0
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'temp.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 1970-01-01 00:00:00
encoder : Lavf53.6.0
Duration: 01:04:52.84, start: 0.000000, bitrate: 553 kb/s
Stream #0.0(und): Video: h264 (Constrained Baseline), yuv420p, 960x640, 552 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc
Metadata:
creation_time : 1970-01-01 00:00:00
Output #0, mp4, to 'temp_croppedFromStart.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 1970-01-01 00:00:00
encoder : Lavf53.6.0
Stream #0.0(und): Video: libx264, yuv420p, 960x640, q=2-31, 552 kb/s, 25 tbn, 25 tbc
Metadata:
creation_time : 1970-01-01 00:00:00
Stream mapping:
Stream #0.0 -> #0.0
Press [q] to stop, [?] for help
frame=96821 fps=45920 q=-1.0 Lsize= 262003kB time=01:04:27.32 bitrate= 555.0kbits/s
video:261244kB audio:0kB global headers:0kB muxing overhead 0.290424%
Duration: 01:04:52.84, start: 0.000000, bitrate: 553 kb/s
Duration: 01:04:32.84, start: 0.000000, bitrate: 554 kb/s









share|improve this question























  • I tried your line, C:>ffmpeg -ss # -i temp.mp4 -y -vcodec copy temp_croppedFromStart.mp4 and it worked with my mp4 here's a good one to test it on youtube.com/watch?v=c1kTgHJ_RHo maybe your video codec is funny, not well supported or something, try changing it to something else maybe, and report back

    – barlop
    Sep 18 '11 at 19:07
















3












3








3


1






I'm trying to remove a few seconds off the front of a video stream (audio already excluded), and I'm getting strange results: I would think that for every second I increase -ss by, the resulting file would be a second shorter... that doesn't seem to be the case.



original     ==> 01:04:52.84
-ss 19 ==> 01:04:42.84 (diff = 10) [command history shown below]
-ss 20 ==> 01:04:32.84 (diff = 20) [command history shown below]
-ss 21 ==> 01:04:32.84 (diff = 20)
-ss 25 ==> 01:04:32.84 (diff = 20)
-ss 0:0:25.0 ==> 01:04:32.84 (diff = 20)
-ss 0:0:25.5 ==> 01:04:32.84 (diff = 20) [command history shown below]


Command: ffmpeg -ss # -i temp.mp4 -y -vcodec copy temp_croppedFromStart.mp4



Here's the command history for 19 & 20



# ffmpeg -ss 19 -i temp.mp4 -y -vcodec copy  temp_croppedFromStart.mp4; ffmpeg -i temp.mp4 2>&1 | grep Duration; ffmpeg -i temp_croppedFromStart.mp4 2>&1 | grep Duration
ffmpeg version N-31809-g9acffed, Copyright (c) 2000-2011 the FFmpeg developers
built on Aug 10 2011 21:25:11 with gcc 4.4.5
configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-x11grab
libavutil 51. 11. 1 / 51. 11. 1
libavcodec 53. 10. 0 / 53. 10. 0
libavformat 53. 6. 0 / 53. 6. 0
libavdevice 53. 2. 0 / 53. 2. 0
libavfilter 2. 28. 1 / 2. 28. 1
libswscale 2. 0. 0 / 2. 0. 0
libpostproc 51. 2. 0 / 51. 2. 0
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'temp.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 1970-01-01 00:00:00
encoder : Lavf53.6.0
Duration: 01:04:52.84, start: 0.000000, bitrate: 553 kb/s
Stream #0.0(und): Video: h264 (Constrained Baseline), yuv420p, 960x640, 552 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc
Metadata:
creation_time : 1970-01-01 00:00:00
Output #0, mp4, to 'temp_croppedFromStart.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 1970-01-01 00:00:00
encoder : Lavf53.6.0
Stream #0.0(und): Video: libx264, yuv420p, 960x640, q=2-31, 552 kb/s, 25 tbn, 25 tbc
Metadata:
creation_time : 1970-01-01 00:00:00
Stream mapping:
Stream #0.0 -> #0.0
Press [q] to stop, [?] for help
frame=97071 fps=42523 q=-1.0 Lsize= 262684kB time=01:04:33.84 bitrate= 555.5kbits/s
video:261923kB audio:0kB global headers:0kB muxing overhead 0.290418%
Duration: 01:04:52.84, start: 0.000000, bitrate: 553 kb/s
Duration: 01:04:42.84, start: 0.000000, bitrate: 554 kb/s


# ffmpeg -ss 20 -i temp.mp4 -y -vcodec copy temp_croppedFromStart.mp4; ffmpeg -i temp.mp4 2>&1 | grep Duration; ffmpeg -i temp_croppedFromStart.mp4 2>&1 | grep Duration
ffmpeg version N-31809-g9acffed, Copyright (c) 2000-2011 the FFmpeg developers
built on Aug 10 2011 21:25:11 with gcc 4.4.5
configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-x11grab
libavutil 51. 11. 1 / 51. 11. 1
libavcodec 53. 10. 0 / 53. 10. 0
libavformat 53. 6. 0 / 53. 6. 0
libavdevice 53. 2. 0 / 53. 2. 0
libavfilter 2. 28. 1 / 2. 28. 1
libswscale 2. 0. 0 / 2. 0. 0
libpostproc 51. 2. 0 / 51. 2. 0
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'temp.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 1970-01-01 00:00:00
encoder : Lavf53.6.0
Duration: 01:04:52.84, start: 0.000000, bitrate: 553 kb/s
Stream #0.0(und): Video: h264 (Constrained Baseline), yuv420p, 960x640, 552 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc
Metadata:
creation_time : 1970-01-01 00:00:00
Output #0, mp4, to 'temp_croppedFromStart.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 1970-01-01 00:00:00
encoder : Lavf53.6.0
Stream #0.0(und): Video: libx264, yuv420p, 960x640, q=2-31, 552 kb/s, 25 tbn, 25 tbc
Metadata:
creation_time : 1970-01-01 00:00:00
Stream mapping:
Stream #0.0 -> #0.0
Press [q] to stop, [?] for help
frame=96821 fps=47168 q=-1.0 Lsize= 262003kB time=01:04:32.84 bitrate= 554.2kbits/s
video:261244kB audio:0kB global headers:0kB muxing overhead 0.290410%
Duration: 01:04:52.84, start: 0.000000, bitrate: 553 kb/s
Duration: 01:04:32.84, start: 0.000000, bitrate: 554 kb/s

# ffmpeg -ss 0:0:25.5 -i temp.mp4 -y -vcodec copy temp_croppedFromStart.mp4; ffmpeg -i temp.mp4 2>&1 | grep Duration; ffmpeg -i temp_croppedFromStart.mp4 2>&1 | grep Duration
ffmpeg version N-31809-g9acffed, Copyright (c) 2000-2011 the FFmpeg developers
built on Aug 10 2011 21:25:11 with gcc 4.4.5
configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-x11grab
libavutil 51. 11. 1 / 51. 11. 1
libavcodec 53. 10. 0 / 53. 10. 0
libavformat 53. 6. 0 / 53. 6. 0
libavdevice 53. 2. 0 / 53. 2. 0
libavfilter 2. 28. 1 / 2. 28. 1
libswscale 2. 0. 0 / 2. 0. 0
libpostproc 51. 2. 0 / 51. 2. 0
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'temp.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 1970-01-01 00:00:00
encoder : Lavf53.6.0
Duration: 01:04:52.84, start: 0.000000, bitrate: 553 kb/s
Stream #0.0(und): Video: h264 (Constrained Baseline), yuv420p, 960x640, 552 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc
Metadata:
creation_time : 1970-01-01 00:00:00
Output #0, mp4, to 'temp_croppedFromStart.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 1970-01-01 00:00:00
encoder : Lavf53.6.0
Stream #0.0(und): Video: libx264, yuv420p, 960x640, q=2-31, 552 kb/s, 25 tbn, 25 tbc
Metadata:
creation_time : 1970-01-01 00:00:00
Stream mapping:
Stream #0.0 -> #0.0
Press [q] to stop, [?] for help
frame=96821 fps=45920 q=-1.0 Lsize= 262003kB time=01:04:27.32 bitrate= 555.0kbits/s
video:261244kB audio:0kB global headers:0kB muxing overhead 0.290424%
Duration: 01:04:52.84, start: 0.000000, bitrate: 553 kb/s
Duration: 01:04:32.84, start: 0.000000, bitrate: 554 kb/s









share|improve this question














I'm trying to remove a few seconds off the front of a video stream (audio already excluded), and I'm getting strange results: I would think that for every second I increase -ss by, the resulting file would be a second shorter... that doesn't seem to be the case.



original     ==> 01:04:52.84
-ss 19 ==> 01:04:42.84 (diff = 10) [command history shown below]
-ss 20 ==> 01:04:32.84 (diff = 20) [command history shown below]
-ss 21 ==> 01:04:32.84 (diff = 20)
-ss 25 ==> 01:04:32.84 (diff = 20)
-ss 0:0:25.0 ==> 01:04:32.84 (diff = 20)
-ss 0:0:25.5 ==> 01:04:32.84 (diff = 20) [command history shown below]


Command: ffmpeg -ss # -i temp.mp4 -y -vcodec copy temp_croppedFromStart.mp4



Here's the command history for 19 & 20



# ffmpeg -ss 19 -i temp.mp4 -y -vcodec copy  temp_croppedFromStart.mp4; ffmpeg -i temp.mp4 2>&1 | grep Duration; ffmpeg -i temp_croppedFromStart.mp4 2>&1 | grep Duration
ffmpeg version N-31809-g9acffed, Copyright (c) 2000-2011 the FFmpeg developers
built on Aug 10 2011 21:25:11 with gcc 4.4.5
configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-x11grab
libavutil 51. 11. 1 / 51. 11. 1
libavcodec 53. 10. 0 / 53. 10. 0
libavformat 53. 6. 0 / 53. 6. 0
libavdevice 53. 2. 0 / 53. 2. 0
libavfilter 2. 28. 1 / 2. 28. 1
libswscale 2. 0. 0 / 2. 0. 0
libpostproc 51. 2. 0 / 51. 2. 0
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'temp.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 1970-01-01 00:00:00
encoder : Lavf53.6.0
Duration: 01:04:52.84, start: 0.000000, bitrate: 553 kb/s
Stream #0.0(und): Video: h264 (Constrained Baseline), yuv420p, 960x640, 552 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc
Metadata:
creation_time : 1970-01-01 00:00:00
Output #0, mp4, to 'temp_croppedFromStart.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 1970-01-01 00:00:00
encoder : Lavf53.6.0
Stream #0.0(und): Video: libx264, yuv420p, 960x640, q=2-31, 552 kb/s, 25 tbn, 25 tbc
Metadata:
creation_time : 1970-01-01 00:00:00
Stream mapping:
Stream #0.0 -> #0.0
Press [q] to stop, [?] for help
frame=97071 fps=42523 q=-1.0 Lsize= 262684kB time=01:04:33.84 bitrate= 555.5kbits/s
video:261923kB audio:0kB global headers:0kB muxing overhead 0.290418%
Duration: 01:04:52.84, start: 0.000000, bitrate: 553 kb/s
Duration: 01:04:42.84, start: 0.000000, bitrate: 554 kb/s


# ffmpeg -ss 20 -i temp.mp4 -y -vcodec copy temp_croppedFromStart.mp4; ffmpeg -i temp.mp4 2>&1 | grep Duration; ffmpeg -i temp_croppedFromStart.mp4 2>&1 | grep Duration
ffmpeg version N-31809-g9acffed, Copyright (c) 2000-2011 the FFmpeg developers
built on Aug 10 2011 21:25:11 with gcc 4.4.5
configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-x11grab
libavutil 51. 11. 1 / 51. 11. 1
libavcodec 53. 10. 0 / 53. 10. 0
libavformat 53. 6. 0 / 53. 6. 0
libavdevice 53. 2. 0 / 53. 2. 0
libavfilter 2. 28. 1 / 2. 28. 1
libswscale 2. 0. 0 / 2. 0. 0
libpostproc 51. 2. 0 / 51. 2. 0
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'temp.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 1970-01-01 00:00:00
encoder : Lavf53.6.0
Duration: 01:04:52.84, start: 0.000000, bitrate: 553 kb/s
Stream #0.0(und): Video: h264 (Constrained Baseline), yuv420p, 960x640, 552 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc
Metadata:
creation_time : 1970-01-01 00:00:00
Output #0, mp4, to 'temp_croppedFromStart.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 1970-01-01 00:00:00
encoder : Lavf53.6.0
Stream #0.0(und): Video: libx264, yuv420p, 960x640, q=2-31, 552 kb/s, 25 tbn, 25 tbc
Metadata:
creation_time : 1970-01-01 00:00:00
Stream mapping:
Stream #0.0 -> #0.0
Press [q] to stop, [?] for help
frame=96821 fps=47168 q=-1.0 Lsize= 262003kB time=01:04:32.84 bitrate= 554.2kbits/s
video:261244kB audio:0kB global headers:0kB muxing overhead 0.290410%
Duration: 01:04:52.84, start: 0.000000, bitrate: 553 kb/s
Duration: 01:04:32.84, start: 0.000000, bitrate: 554 kb/s

# ffmpeg -ss 0:0:25.5 -i temp.mp4 -y -vcodec copy temp_croppedFromStart.mp4; ffmpeg -i temp.mp4 2>&1 | grep Duration; ffmpeg -i temp_croppedFromStart.mp4 2>&1 | grep Duration
ffmpeg version N-31809-g9acffed, Copyright (c) 2000-2011 the FFmpeg developers
built on Aug 10 2011 21:25:11 with gcc 4.4.5
configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-x11grab
libavutil 51. 11. 1 / 51. 11. 1
libavcodec 53. 10. 0 / 53. 10. 0
libavformat 53. 6. 0 / 53. 6. 0
libavdevice 53. 2. 0 / 53. 2. 0
libavfilter 2. 28. 1 / 2. 28. 1
libswscale 2. 0. 0 / 2. 0. 0
libpostproc 51. 2. 0 / 51. 2. 0
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'temp.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 1970-01-01 00:00:00
encoder : Lavf53.6.0
Duration: 01:04:52.84, start: 0.000000, bitrate: 553 kb/s
Stream #0.0(und): Video: h264 (Constrained Baseline), yuv420p, 960x640, 552 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc
Metadata:
creation_time : 1970-01-01 00:00:00
Output #0, mp4, to 'temp_croppedFromStart.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 1970-01-01 00:00:00
encoder : Lavf53.6.0
Stream #0.0(und): Video: libx264, yuv420p, 960x640, q=2-31, 552 kb/s, 25 tbn, 25 tbc
Metadata:
creation_time : 1970-01-01 00:00:00
Stream mapping:
Stream #0.0 -> #0.0
Press [q] to stop, [?] for help
frame=96821 fps=45920 q=-1.0 Lsize= 262003kB time=01:04:27.32 bitrate= 555.0kbits/s
video:261244kB audio:0kB global headers:0kB muxing overhead 0.290424%
Duration: 01:04:52.84, start: 0.000000, bitrate: 553 kb/s
Duration: 01:04:32.84, start: 0.000000, bitrate: 554 kb/s






ffmpeg






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Sep 16 '11 at 16:13









Alan BlountAlan Blount

11614




11614













  • I tried your line, C:>ffmpeg -ss # -i temp.mp4 -y -vcodec copy temp_croppedFromStart.mp4 and it worked with my mp4 here's a good one to test it on youtube.com/watch?v=c1kTgHJ_RHo maybe your video codec is funny, not well supported or something, try changing it to something else maybe, and report back

    – barlop
    Sep 18 '11 at 19:07





















  • I tried your line, C:>ffmpeg -ss # -i temp.mp4 -y -vcodec copy temp_croppedFromStart.mp4 and it worked with my mp4 here's a good one to test it on youtube.com/watch?v=c1kTgHJ_RHo maybe your video codec is funny, not well supported or something, try changing it to something else maybe, and report back

    – barlop
    Sep 18 '11 at 19:07



















I tried your line, C:>ffmpeg -ss # -i temp.mp4 -y -vcodec copy temp_croppedFromStart.mp4 and it worked with my mp4 here's a good one to test it on youtube.com/watch?v=c1kTgHJ_RHo maybe your video codec is funny, not well supported or something, try changing it to something else maybe, and report back

– barlop
Sep 18 '11 at 19:07







I tried your line, C:>ffmpeg -ss # -i temp.mp4 -y -vcodec copy temp_croppedFromStart.mp4 and it worked with my mp4 here's a good one to test it on youtube.com/watch?v=c1kTgHJ_RHo maybe your video codec is funny, not well supported or something, try changing it to something else maybe, and report back

– barlop
Sep 18 '11 at 19:07












1 Answer
1






active

oldest

votes


















0














With H.264 video you have group of pictures.



To save space some of the frames are inter frames



You can only cut H.264 on an Intra-frame AKA I-frame.



What I did was transcode using a lossless codec, then reencode



ffmpeg -i input.mkv -c:v ffvhuff FFVhuff.mkv

ffmpeg -ss 26.818 -i FFVhuff.mkv trim.mkv


http://svnpenn.blogspot.com/2011/10/ffmpeg-cut-to-frame-same-audio.html






share|improve this answer























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "3"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f336433%2fffmpeg-trying-to-remove-the-first-few-seconds-of-video%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    With H.264 video you have group of pictures.



    To save space some of the frames are inter frames



    You can only cut H.264 on an Intra-frame AKA I-frame.



    What I did was transcode using a lossless codec, then reencode



    ffmpeg -i input.mkv -c:v ffvhuff FFVhuff.mkv

    ffmpeg -ss 26.818 -i FFVhuff.mkv trim.mkv


    http://svnpenn.blogspot.com/2011/10/ffmpeg-cut-to-frame-same-audio.html






    share|improve this answer




























      0














      With H.264 video you have group of pictures.



      To save space some of the frames are inter frames



      You can only cut H.264 on an Intra-frame AKA I-frame.



      What I did was transcode using a lossless codec, then reencode



      ffmpeg -i input.mkv -c:v ffvhuff FFVhuff.mkv

      ffmpeg -ss 26.818 -i FFVhuff.mkv trim.mkv


      http://svnpenn.blogspot.com/2011/10/ffmpeg-cut-to-frame-same-audio.html






      share|improve this answer


























        0












        0








        0







        With H.264 video you have group of pictures.



        To save space some of the frames are inter frames



        You can only cut H.264 on an Intra-frame AKA I-frame.



        What I did was transcode using a lossless codec, then reencode



        ffmpeg -i input.mkv -c:v ffvhuff FFVhuff.mkv

        ffmpeg -ss 26.818 -i FFVhuff.mkv trim.mkv


        http://svnpenn.blogspot.com/2011/10/ffmpeg-cut-to-frame-same-audio.html






        share|improve this answer













        With H.264 video you have group of pictures.



        To save space some of the frames are inter frames



        You can only cut H.264 on an Intra-frame AKA I-frame.



        What I did was transcode using a lossless codec, then reencode



        ffmpeg -i input.mkv -c:v ffvhuff FFVhuff.mkv

        ffmpeg -ss 26.818 -i FFVhuff.mkv trim.mkv


        http://svnpenn.blogspot.com/2011/10/ffmpeg-cut-to-frame-same-audio.html







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 6 '11 at 22:59









        Steven PennySteven Penny

        1




        1






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Super User!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f336433%2fffmpeg-trying-to-remove-the-first-few-seconds-of-video%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Список кардиналов, возведённых папой римским Каликстом III

            Deduzione

            Mysql.sock missing - “Can't connect to local MySQL server through socket”