Estou tentando dividir um vídeo em várias partes. No entanto, quando defino o tamanho do segmento para menos de 10 segundos, ele gera segmentos de 10 segundos. Funciona se o tamanho do segmento for maior que 10 segundos. Este é o comando que estou usando,
ffmpeg -i HVC656729.mp4 -acodec copy -f segment -segment_time 5 -vcodec copy -reset_timestamps 1 -map 0 -an fff%d.mp4
Eu também tentei outra opção:
ffmpeg -i 'HVC656729.mp4' -strict -2 -vcodec copy -ss 0 -t 5 '0.mp4'
ffmpeg -i ’HVC656729.mp4' -strict -2 -vcodec copy -ss 5 -t 5 '1.mp4'
ffmpeg -i 'HVC656729.mp4' -strict -2 -vcodec copy -ss 10 -t 5 '2.mp4'
ffmpeg -i 'HVC656729.mp4' -strict -2 -vcodec copy -ss 15 -t 5 '3.mp4'
ffmpeg -i 'HVC656729.mp4' -strict -2 -vcodec copy -ss 20 -t 5 '4.mp4'
ffmpeg -i 'HVC656729.mp4' -strict -2 -vcodec copy -ss 25 -t 5 '5.mp4'
ffmpeg -i 'HVC656729.mp4' -strict -2 -vcodec copy -ss 30 -t 5 '6.mp4'
ffmpeg -i 'HVC656729.mp4' -strict -2 -vcodec copy -ss 35 -t 5 '7.mp4'
ffmpeg -i 'HVC656729.mp4' -strict -2 -vcodec copy -ss 40 -t 5 '8.mp4'
ffmpeg -i 'HVC656729.mp4' -strict -2 -vcodec copy -ss 45 -t 5 '9.mp4'
ffmpeg -i 'HVC656729.mp4' -strict -2 -vcodec copy -ss 50 -t 5 '10.mp4’
e assim por diante até a duração do vídeo, no entanto, neste caso, o número ímpar de vídeos contém apenas áudio e nenhum vídeo, enquanto o número de vídeos pares contém vídeos. Quando eu definir a duração para 10 segundos, até mesmo essa coisa começa a funcionar. Eu não tenho certeza do que está acontecendo, porque a documentação do ffmpeg também diz que o segment_size padrão é de 2 segundos ffmpeg link , eu não sei por que isso está acontecendo.
O vídeo pode ser visto aqui se você precisar de uma referência .
A saída do primeiro comando é a seguinte:
ffmpeg -i /lustre/bharat/devo/HVC656729.mp4 -acodec copy -f segment -segment_time 5 -vcodec copy -reset_timestamps 1 -map 0 -an fff%d.mp4
ffmpeg version 2.0.2 Copyright (c) 2000-2013 the FFmpeg developers
built on Oct 23 2013 08:49:53 with gcc 4.6.1 (GCC)
configuration: --prefix=/usr/local/ffmpeg/2.0.2 --libdir=/usr/local/ffmpeg/lib
libavutil 52. 38.100 / 52. 38.100
libavcodec 55. 18.102 / 55. 18.102
libavformat 55. 12.100 / 55. 12.100
libavdevice 55. 3.100 / 55. 3.100
libavfilter 3. 79.101 / 3. 79.101
libswscale 2. 3.100 / 2. 3.100
libswresample 0. 17.102 / 0. 17.102
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/lustre/bharat/devo/HVC656729.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 1970-01-01 00:00:00
encoder : Lavf52.68.0
Duration: 00:02:57.39, start: 0.000000, bitrate: 637 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 320x240, 504 kb/s, 23.96 fps, 23.98 tbr, 24k tbn, 47.95 tbc
Metadata:
creation_time : 1970-01-01 00:00:00
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 127 kb/s
Metadata:
creation_time : 1970-01-01 00:00:00
handler_name : SoundHandler
Output #0, segment, to 'fff%d.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf55.12.100
Stream #0:0(und): Video: h264 (avc1 / 0x31637661), yuv420p, 320x240, q=2-31, 504 kb/s, 23.96 fps, 90k tbn, 23.98 tbc
Metadata:
creation_time : 1970-01-01 00:00:00
handler_name : VideoHandler
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame= 4250 fps=0.0 q=-1.0 Lsize=N/A time=00:02:57.34 bitrate=N/A
video:10934kB audio:0kB subtitle:0 global headers:0kB muxing overhead -100.000196%
Saída da versão ímpar (segundo comando):
ffmpeg -i '/lustre/bharat/devo/HVC656729.mp4' -strict -2 -vcodec copy -ss 5 -t 5 '1.mp4'
ffmpeg version 2.0.2 Copyright (c) 2000-2013 the FFmpeg developers
built on Oct 23 2013 08:49:53 with gcc 4.6.1 (GCC)
configuration: --prefix=/usr/local/ffmpeg/2.0.2 --libdir=/usr/local/ffmpeg/lib
libavutil 52. 38.100 / 52. 38.100
libavcodec 55. 18.102 / 55. 18.102
libavformat 55. 12.100 / 55. 12.100
libavdevice 55. 3.100 / 55. 3.100
libavfilter 3. 79.101 / 3. 79.101
libswscale 2. 3.100 / 2. 3.100
libswresample 0. 17.102 / 0. 17.102
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/lustre/bharat/devo/HVC656729.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 1970-01-01 00:00:00
encoder : Lavf52.68.0
Duration: 00:02:57.39, start: 0.000000, bitrate: 637 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 320x240, 504 kb/s, 23.96 fps, 23.98 tbr, 24k tbn, 47.95 tbc
Metadata:
creation_time : 1970-01-01 00:00:00
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 127 kb/s
Metadata:
creation_time : 1970-01-01 00:00:00
handler_name : SoundHandler
Output #0, mp4, to '1.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf55.12.100
Stream #0:0(und): Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 320x240, q=2-31, 504 kb/s, 23.96 fps, 24k tbn, 24k tbc
Metadata:
creation_time : 1970-01-01 00:00:00
handler_name : VideoHandler
Stream #0:1(und): Audio: aac ([64][0][0][0] / 0x0040), 44100 Hz, stereo, fltp, 128 kb/s
Metadata:
creation_time : 1970-01-01 00:00:00
handler_name : SoundHandler
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (aac -> aac)
Press [q] to stop, [?] for help
frame= 0 fps=0.0 q=-1.0 Lsize= 80kB time=00:00:05.01 bitrate= 130.8kbits/s
video:0kB audio:78kB subtitle:0 global headers:0kB muxing overhead 2.015301%
Saída da versão par:
ffmpeg -i '/lustre/bharat/devo/HVC656729.mp4' -strict -2 -vcodec copy -ss 0 -t 5 '0.mp4'
ffmpeg version 2.0.2 Copyright (c) 2000-2013 the FFmpeg developers
built on Oct 23 2013 08:49:53 with gcc 4.6.1 (GCC)
configuration: --prefix=/usr/local/ffmpeg/2.0.2 --libdir=/usr/local/ffmpeg/lib
libavutil 52. 38.100 / 52. 38.100
libavcodec 55. 18.102 / 55. 18.102
libavformat 55. 12.100 / 55. 12.100
libavdevice 55. 3.100 / 55. 3.100
libavfilter 3. 79.101 / 3. 79.101
libswscale 2. 3.100 / 2. 3.100
libswresample 0. 17.102 / 0. 17.102
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/lustre/bharat/devo/HVC656729.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 1970-01-01 00:00:00
encoder : Lavf52.68.0
Duration: 00:02:57.39, start: 0.000000, bitrate: 637 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 320x240, 504 kb/s, 23.96 fps, 23.98 tbr, 24k tbn, 47.95 tbc
Metadata:
creation_time : 1970-01-01 00:00:00
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 127 kb/s
Metadata:
creation_time : 1970-01-01 00:00:00
handler_name : SoundHandler
Output #0, mp4, to '0.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf55.12.100
Stream #0:0(und): Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 320x240, q=2-31, 504 kb/s, 23.96 fps, 24k tbn, 24k tbc
Metadata:
creation_time : 1970-01-01 00:00:00
handler_name : VideoHandler
Stream #0:1(und): Audio: aac ([64][0][0][0] / 0x0040), 44100 Hz, stereo, fltp, 128 kb/s
Metadata:
creation_time : 1970-01-01 00:00:00
handler_name : SoundHandler
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (aac -> aac)
Press [q] to stop, [?] for help
frame= 119 fps=0.0 q=-1.0 Lsize= 386kB time=00:00:05.01 bitrate= 630.4kbits/s
video:302kB audio:80kB subtitle:0 global headers:0kB muxing overhead 1.218538%