У меня есть файл, который я хотел разрезать на несколько частей. Проблема в том, что моя команда не всегда работает: ffmpeg -ss 00:00:05 -i 4.DeepPurpleJag_robocze.mp4 -to 01:00:21 -c:v copy -c:a copy testing.mp4
производит правильно обрезанное видео с выводом:
ffmpeg version 4.2.1 Copyright (c) 2000-2019 the FFmpeg developers
built with Apple clang version 11.0.0 (clang-1100.0.33.8)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.2.1_2 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags='-I/Library/Java/JavaVirtualMachines/adoptopenjdk-13.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/adoptopenjdk-13.jdk/Contents/Home/include/darwin -fno-stack-check' --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack --disable-indev=jack
libavutil 56. 31.100 / 56. 31.100
libavcodec 58. 54.100 / 58. 54.100
libavformat 58. 29.100 / 58. 29.100
libavdevice 58. 8.100 / 58. 8.100
libavfilter 7. 57.100 / 7. 57.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 5.100 / 5. 5.100
libswresample 3. 5.100 / 3. 5.100
libpostproc 55. 5.100 / 55. 5.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '4.DeepPurpleJag_robocze.mp4':
Metadata:
major_brand : mp42
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 2019-11-09T13:18:48.000000Z
encoder : HandBrake 1.2.2 2019022300
Duration: 03:05:31.33, start: 0.000000, bitrate: 1045 kb/s
Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, smpte170m/bt470bg/bt709), 350x480 [SAR 65535:35816 DAR 764575:573056], 904 kb/s, SAR 14801:8089 DAR 518035:388272, 25 fps, 25 tbr, 90k tbn, 180k tbc (default)
Metadata:
creation_time : 2019-11-09T13:18:48.000000Z
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 134 kb/s (default)
Metadata:
creation_time : 2019-11-09T13:18:48.000000Z
handler_name : SoundHandler
File 'testing.mp4' already exists. Overwrite ? [y/N] y
Output #0, mp4, to 'testing.mp4':
Metadata:
major_brand : mp42
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.29.100
Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, smpte170m/bt470bg/bt709), 350x480 [SAR 14801:8089 DAR 518035:388272], q=2-31, 904 kb/s, 25 fps, 25 tbr, 90k tbn, 90k tbc (default)
Metadata:
creation_time : 2019-11-09T13:18:48.000000Z
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 134 kb/s (default)
Metadata:
creation_time : 2019-11-09T13:18:48.000000Z
handler_name : SoundHandler
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=23390 fps=0.0 q=-1.0 size= 122880kB time=00:15:35.35 bitrate=1076.2kbits/s sframe=47377 fps=47167 q=-1.0 size= 259584kB time=00:31:34.83 bitrate=1122.3kbits/sframe=74437 fps=49477 q=-1.0 size= 401664kB time=00:49:37.22 bitrate=1105.2kbits/sframe=90531 fps=47477 q=-1.0 Lsize= 518987kB time=01:00:20.98 bitrate=1174.1kbits/s speed=1.9e+03x
video:457170kB audio:59123kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.521705%
Однако, когда я пытаюсь обрезать один и тот же источник с разными ss и мне это нравится ffmpeg -ss 01:40:05 -i 4.DeepPurpleJag_robocze.mp4 -to 02:19:21 -c:v copy -c:a copy testing2.mp4
, я получилвыходной файл длиной более 1,5 часов вместо 39 минут - флаг -to игнорируется и файл обрезается до конца. вывод:
ffmpeg version 4.2.1 Copyright (c) 2000-2019 the FFmpeg developers
built with Apple clang version 11.0.0 (clang-1100.0.33.8)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.2.1_2 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags='-I/Library/Java/JavaVirtualMachines/adoptopenjdk-13.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/adoptopenjdk-13.jdk/Contents/Home/include/darwin -fno-stack-check' --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack --disable-indev=jack
libavutil 56. 31.100 / 56. 31.100
libavcodec 58. 54.100 / 58. 54.100
libavformat 58. 29.100 / 58. 29.100
libavdevice 58. 8.100 / 58. 8.100
libavfilter 7. 57.100 / 7. 57.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 5.100 / 5. 5.100
libswresample 3. 5.100 / 3. 5.100
libpostproc 55. 5.100 / 55. 5.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '4.DeepPurpleJag_robocze.mp4':
Metadata:
major_brand : mp42
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 2019-11-09T13:18:48.000000Z
encoder : HandBrake 1.2.2 2019022300
Duration: 03:05:31.33, start: 0.000000, bitrate: 1045 kb/s
Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, smpte170m/bt470bg/bt709), 350x480 [SAR 65535:35816 DAR 764575:573056], 904 kb/s, SAR 14801:8089 DAR 518035:388272, 25 fps, 25 tbr, 90k tbn, 180k tbc (default)
Metadata:
creation_time : 2019-11-09T13:18:48.000000Z
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 134 kb/s (default)
Metadata:
creation_time : 2019-11-09T13:18:48.000000Z
handler_name : SoundHandler
File 'testing2.mp4' already exists. Overwrite ? [y/N] y
Output #0, mp4, to 'testing2.mp4':
Metadata:
major_brand : mp42
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.29.100
Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, smpte170m/bt470bg/bt709), 350x480 [SAR 14801:8089 DAR 518035:388272], q=2-31, 904 kb/s, 25 fps, 25 tbr, 90k tbn, 90k tbc (default)
Metadata:
creation_time : 2019-11-09T13:18:48.000000Z
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 134 kb/s (default)
Metadata:
creation_time : 2019-11-09T13:18:48.000000Z
handler_name : SoundHandler
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=31213 fps=0.0 q=-1.0 size= 122624kB time=00:20:45.83 bitrate= 806.3kbits/s sframe=61164 fps=61143 q=-1.0 size= 267264kB time=00:40:43.87 bitrate= 895.9kbits/sframe=91215 fps=60795 q=-1.0 size= 414464kB time=01:00:45.90 bitrate= 931.3kbits/sframe=117850 fps=58914 q=-1.0 size= 541440kB time=01:18:31.28 bitrate= 941.5kbits/frame=128220 fps=58002 q=-1.0 Lsize= 581509kB time=01:25:26.26 bitrate= 929.3kbits/s speed=2.32e+03x
video:493385kB audio:84316kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.659221%
Я понятия не имею, что происходит, когда я пытаюсь вырезать фильм с помощью ручного тормоза, все в порядке. Я могу предоставить файл в случае необходимости.