Я без потерь извлек 30 м из видео длиной ~ 1,5 часа, используя следующую ffmpeg
команду:
ffmpeg -ss 0 -t 00:30:00 -i in.mp4 -acodec copy -vcodec copy out.mp4
Разделение было успешным и out.mp4
было создано с первых 30 метров.
Однако... даже несмотря на то, что видео останавливается через 30 м, видеопроигрыватели, такие как VLC и Windows Media Player, показывают, что длина видео по-прежнему составляет ~1,5 часа, как и проводник Windows при выборе файла.
Почему показанная длина видео отличается от фактической?
Как я могу настроить его, чтобы они совпадали?
Я на Win7, используя 64-битную статику ffmpeg с 10 февраля 2015 года.
Кроме того, вот результат процесса:
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%
Вот результат 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
Как написал @LordNeckbeard в комментариях, перемещение -t
флага после того, как -i
флаг работает:
ffmpeg -ss 0 -i in.mp4 -t 00:30:00 -acodec copy -vcodec copy out.mp4
-shortest
как выходной вариант. Я думаю, что то, что происходит, -t
возможно, относится только к одному из потоков во входном файле или что-то в этом роде.
Логан
Джонатан
Джонатан
Джонатан
Логан
-ss 0
? Что, если вы переместитесь-t 00:30:00
после ввода, чтобы он вместо этого использовался как вариант вывода?Джонатан
-t
после того, как ввод-i
сделал свое дело .. Напишите это как ответ, и я приму его :)Джонатан
Логан
-t
это и входная, и выходная опция, поэтому я предполагаю, что это не имеет большого значения. Возможно, вы нашли ошибку. Это происходит со всеми входами или только с определенным(и)? Я не могу дублировать проблему.