0

I've losslessly extracted 30m from a ~1.5h long video using the following ffmpeg command:

ffmpeg -ss 0 -t 00:30:00 -i in.mp4 -acodec copy -vcodec copy out.mp4

The split was successful and out.mp4 was created with the first 30m.
However... even though the video stops after 30m, video players such as VLC and Windows Media Player show the video length as still being ~1.5h long, and so does Windows Explorer when the file is selected.

How come the video length shown is different than the actual video length?
How can I adjust it so they will match?

I'm on Win7 using ffmpeg 64bit static from Feb 10th 2015.
Also, here is the output of the process:

ffmpeg version N-69672-g078be09 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.9.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnu
tls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-
libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-l
ibrtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --
enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --ena
ble-libxvid --enable-lzma --enable-decklink --enable-zlib
  libavutil      54. 18.100 / 54. 18.100
  libavcodec     56. 21.102 / 56. 21.102
  libavformat    56. 19.100 / 56. 19.100
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5.  9.104 /  5.  9.104
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000000000307fe0] overread end of atom 'colr' by 1 bytes
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'in.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42isomavc1
    creation_time   : 2015-02-11 15:31:12
    encoder         : HandBrake 0.9.8 2012071700
  Duration: 01:33:46.64, start: 0.000000, bitrate: 2556 kb/s
    Chapter #0:0: start -0.160000, end 301.040000
    Metadata:
      title           : Chapter 1
    Chapter #0:1: start 301.040000, end 600.560000
    Metadata:
      title           : Chapter 2
    Chapter #0:2: start 600.560000, end 901.040000
    Metadata:
      title           : Chapter 3
    Chapter #0:3: start 901.040000, end 1200.560000
    Metadata:
      title           : Chapter 4
    Chapter #0:4: start 1200.560000, end 1501.040000
    Metadata:
      title           : Chapter 5
    Chapter #0:5: start 1501.040000, end 1800.560000
    Metadata:
      title           : Chapter 6
    Chapter #0:6: start 1800.560000, end 2101.040000
    Metadata:
      title           : Chapter 7
    Chapter #0:7: start 2101.040000, end 2400.560000
    Metadata:
      title           : Chapter 8
    Chapter #0:8: start 2400.560000, end 2701.040000
    Metadata:
      title           : Chapter 9
    Chapter #0:9: start 2701.040000, end 3000.560000
    Metadata:
      title           : Chapter 10
    Chapter #0:10: start 3000.560000, end 3301.040000
    Metadata:
      title           : Chapter 11
    Chapter #0:11: start 3301.040000, end 3600.560000
    Metadata:
      title           : Chapter 12
    Chapter #0:12: start 3600.560000, end 3901.040000
    Metadata:
      title           : Chapter 13
    Chapter #0:13: start 3901.040000, end 4200.560000
    Metadata:
      title           : Chapter 14
    Chapter #0:14: start 4200.560000, end 4501.040000
    Metadata:
      title           : Chapter 15
    Chapter #0:15: start 4501.040000, end 4800.560000
    Metadata:
      title           : Chapter 16
    Chapter #0:16: start 4800.560000, end 5101.040000
    Metadata:
      title           : Chapter 17
    Chapter #0:17: start 5101.040000, end 5400.560000
    Metadata:
      title           : Chapter 18
    Chapter #0:18: start 5400.560000, end 5626.640000
    Metadata:
      title           : Chapter 19
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, smpte170m/smpte170m/bt709), 720x576 [SAR 768:715 DAR 192:143], 2391 kb/s, 25
 fps, 25 tbr, 90k tbn, 180k tbc (default)
    Metadata:
      creation_time   : 2015-02-11 15:31:12
      encoder         : JVT/AVC Coding
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 159 kb/s (default)
    Metadata:
      creation_time   : 2015-02-11 15:31:12
    Stream #0:2(und): Subtitle: mov_text (text / 0x74786574)
    Metadata:
      creation_time   : 2015-02-11 15:31:12
Output #0, mp4, to 'out.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42isomavc1
    encoder         : Lavf56.19.100
    Chapter #0:0: start 0.000000, end 301.040000
    Metadata:
      title           : Chapter 1
    Chapter #0:1: start 301.040000, end 600.560000
    Metadata:
      title           : Chapter 2
    Chapter #0:2: start 600.560000, end 901.040000
    Metadata:
      title           : Chapter 3
    Chapter #0:3: start 901.040000, end 1200.560000
    Metadata:
      title           : Chapter 4
    Chapter #0:4: start 1200.560000, end 1501.040000
    Metadata:
      title           : Chapter 5
    Chapter #0:5: start 1501.040000, end 1800.560000
    Metadata:
      title           : Chapter 6
    Chapter #0:6: start 1800.560000, end 2101.040000
    Metadata:
      title           : Chapter 7
    Chapter #0:7: start 2101.040000, end 2400.560000
    Metadata:
      title           : Chapter 8
    Chapter #0:8: start 2400.560000, end 2701.040000
    Metadata:
      title           : Chapter 9
    Chapter #0:9: start 2701.040000, end 3000.560000
    Metadata:
      title           : Chapter 10
    Chapter #0:10: start 3000.560000, end 3301.040000
    Metadata:
      title           : Chapter 11
    Chapter #0:11: start 3301.040000, end 3600.560000
    Metadata:
      title           : Chapter 12
    Chapter #0:12: start 3600.560000, end 3901.040000
    Metadata:
      title           : Chapter 13
    Chapter #0:13: start 3901.040000, end 4200.560000
    Metadata:
      title           : Chapter 14
    Chapter #0:14: start 4200.560000, end 4501.040000
    Metadata:
      title           : Chapter 15
    Chapter #0:15: start 4501.040000, end 4800.560000
    Metadata:
      title           : Chapter 16
    Chapter #0:16: start 4800.560000, end 5101.040000
    Metadata:
      title           : Chapter 17
    Chapter #0:17: start 5101.040000, end 5400.560000
    Metadata:
      title           : Chapter 18
    Chapter #0:18: start 5400.560000, end 5626.640000
    Metadata:
      title           : Chapter 19
    Stream #0:0(und): Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 720x576 [SAR 768:715 DAR 192:143], q=2-31, 2391 kb/s, 25 fps, 25 tbr, 90k tbn, 90
k tbc (default)
    Metadata:
      creation_time   : 2015-02-11 15:31:12
      encoder         : JVT/AVC Coding
    Stream #0:1(und): Audio: aac ([64][0][0][0] / 0x0040), 48000 Hz, stereo, 159 kb/s (default)
    Metadata:
      creation_time   : 2015-02-11 15:31:12
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=45000 fps=5763 q=-1.0 Lsize=  590048kB time=00:30:00.00 bitrate=2685.4kbits/s
video:553577kB audio:35153kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.223870%

Here's the output of ffmpeg -i out.mp4:

ffmpeg version N-69672-g078be09 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.9.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnu
tls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-
libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-l
ibrtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --
enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --ena
ble-libxvid --enable-lzma --enable-decklink --enable-zlib
  libavutil      54. 18.100 / 54. 18.100
  libavcodec     56. 21.102 / 56. 21.102
  libavformat    56. 19.100 / 56. 19.100
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5.  9.104 /  5.  9.104
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'out.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.19.100
  Duration: 01:33:46.64, start: 0.000000, bitrate: 859 kb/s
    Chapter #0:0: start 0.000000, end 301.040000
    Metadata:
      title           : Chapter 1
    Chapter #0:1: start 301.040000, end 600.560000
    Metadata:
      title           : Chapter 2
    Chapter #0:2: start 600.560000, end 901.040000
    Metadata:
      title           : Chapter 3
    Chapter #0:3: start 901.040000, end 1200.560000
    Metadata:
      title           : Chapter 4
    Chapter #0:4: start 1200.560000, end 1501.040000
    Metadata:
      title           : Chapter 5
    Chapter #0:5: start 1501.040000, end 1800.560000
    Metadata:
      title           : Chapter 6
    Chapter #0:6: start 1800.560000, end 2101.040000
    Metadata:
      title           : Chapter 7
    Chapter #0:7: start 2101.040000, end 2400.560000
    Metadata:
      title           : Chapter 8
    Chapter #0:8: start 2400.560000, end 2701.040000
    Metadata:
      title           : Chapter 9
    Chapter #0:9: start 2701.040000, end 3000.560000
    Metadata:
      title           : Chapter 10
    Chapter #0:10: start 3000.560000, end 3301.040000
    Metadata:
      title           : Chapter 11
    Chapter #0:11: start 3301.040000, end 3600.560000
    Metadata:
      title           : Chapter 12
    Chapter #0:12: start 3600.560000, end 3901.040000
    Metadata:
      title           : Chapter 13
    Chapter #0:13: start 3901.040000, end 4200.560000
    Metadata:
      title           : Chapter 14
    Chapter #0:14: start 4200.560000, end 4501.040000
    Metadata:
      title           : Chapter 15
    Chapter #0:15: start 4501.040000, end 4800.560000
    Metadata:
      title           : Chapter 16
    Chapter #0:16: start 4800.560000, end 5101.040000
    Metadata:
      title           : Chapter 17
    Chapter #0:17: start 5101.040000, end 5400.560000
    Metadata:
      title           : Chapter 18
    Chapter #0:18: start 5400.560000, end 5626.640000
    Metadata:
      title           : Chapter 19
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, smpte170m/smpte170m/bt709), 720x576 [SAR 768:715 DAR 192:143], 2519 kb/s, 25
 fps, 25 tbr, 90k tbn, 180k tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 159 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
    Stream #0:2(eng): Subtitle: mov_text (text / 0x74786574)
    Metadata:
      handler_name    : SubtitleHandler
At least one output file must be specified
  • Please include the complete console output from your command. Which players specifically are you using? – llogan Feb 13 '15 at 18:24
  • @LordNeckbeard - see updated question :) – Jonathan Feb 14 '15 at 10:28
  • @LordNeckbeard - see second update at the bottom of the question :) – Jonathan Feb 15 '15 at 7:05
  • @LordNeckbeard - I'm hanging my hopes up, so please let me know even if you don't know the answer ;) – Jonathan Feb 17 '15 at 7:05
  • Does it make a difference if you remove -ss 0? What if you move -t 00:30:00 after the input so it gets used as an output option instead? – llogan Feb 17 '15 at 18:39
1

As @LordNeckbeard wrote in the comments, moving the -t flag to after the -i flag works:

ffmpeg -ss 0 -i in.mp4 -t 00:30:00 -acodec copy -vcodec copy out.mp4
  • Or use -shortest as an output option. I think what's going on is -t maybe applies to only one of the streams in the input file, or something. – Peter Cordes Feb 26 '15 at 2:48

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.