6초 길이의 오디오(REC00006.wav)가 있습니다. 17초 길이의 비디오(SUNP.avi)가 있습니다.
이 두 파일을 병합해야 하는데 오디오는 비디오의 11초에서 17초 사이에 나와야 합니다.
여기에 코드를 포함합니다. 합체 성공입니다. 하지만 비디오 시작 부분부터 오디오가 나옵니다.
ffmpeg -y -i SUNP.AVI -itsoffset 00:00:11 -i REC00006.wav -acodec copy -vcodec copy -map 0:0 -map 1:0 C:\Users\admin\Desktop\HH3C01650\SUNP_REC00006.avi
다음은 콘솔 출력입니다.
E:\abc>ffmpeg -y -i SUNP.AVI -itsoffset 00:00:11 -i REC00006.wav -acodec copy
-vcodec copy -map 0:0 -map 1:0 C:\Users\admin\Desktop\HH3C01650\SUNP_REC00006.a
vi
ffmpeg version N-59036-g5d8e4f6 Copyright (c) 2000-2013 the FFmpeg developers
built on Dec 12 2013 22:01:01 with gcc 4.8.2 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetyp
e --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --ena
ble-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-l
ibopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libsp
eex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aa
cenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavp
ack --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
libavutil 52. 58.100 / 52. 58.100
libavcodec 55. 45.101 / 55. 45.101
libavformat 55. 22.100 / 55. 22.100
libavdevice 55. 5.102 / 55. 5.102
libavfilter 3. 92.100 / 3. 92.100
libswscale 2. 5.101 / 2. 5.101
libswresample 0. 17.104 / 0. 17.104
libpostproc 52. 3.100 / 52. 3.100
[avi @ 0284f6a0] non-interleaved AVI
Guessed Channel Layout for Input Stream #0.1 : mono
Input #0, avi, from 'SUNP.AVI':
Duration: 00:00:17.55, start: 0.000000, bitrate: 19000 kb/s
Stream #0:0: Video: mjpeg (MJPG / 0x47504A4D), yuvj422p(pc), 1280x720, 30.02
tbr, 30.02 tbn, 30.02 tbc
Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 11025 Hz, mono, s16,
176 kb/s
Guessed Channel Layout for Input Stream #1.0 : stereo
Input #1, wav, from 'REC00006.wav':
Duration: 00:00:06.02, bitrate: 1536 kb/s
Stream #1:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s16
, 1536 kb/s
Output #0, avi, to 'C:\Users\admin\Desktop\HH3C01650\SUNP_REC00006.avi':
Metadata:
ISFT : Lavf55.22.100
Stream #0:0: Video: mjpeg (MJPG / 0x47504A4D), yuvj422p, 1280x720, q=2-31, 3
0.02 tbn, 30.02 tbc
Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, 153
6 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #1:0 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame= 136 fps=0.0 q=-1.0 size= 15435kB time=00:00:06.32 bitrate=19979.3kbits
frame= 253 fps=0.0 q=-1.0 size= 27039kB time=00:00:11.62 bitrate=19054.4kbits
frame= 324 fps=216 q=-1.0 size= 34804kB time=00:00:14.68 bitrate=19409.4kbits
frame= 386 fps=221 q=-1.0 Lsize= 41424kB time=00:00:17.55 bitrate=19331.3kbit
s/s
video:40267kB audio:1128kB subtitle:0 global headers:0kB muxing overhead 0.06923
6%
E:\abc>ffmpeg -y -i SUNP.AVI -itsoffset 00:00:11 -i REC00006.wav -acodec copy
-vcodec copy -map 0:0 -map 1:0 C:\Users\admin\Desktop\HH3C01650\SUNP_REC00006.a
vi
답변1
이것을 사용하십시오:
ffmpeg -y -i F:\DCIM\100MEDIA\SUNP.AVI -itsoffset 00:00:11 -i F:\RECORD\REC00006.wav -acodec copy -vcodec copy -map 0:0 -map 1:0 C:\Users\admin\Desktop\HH3C01650\SUNP_REC00006.avi
-y
동일한 출력 이름으로 기존 파일을 덮어쓰려면 처음에 한 번만 필요합니다 . 매개 변수는 형식 또는 형식 itsoffset
이어야 합니다 .HH:MM:SS
HH:MM:SS.DECIMAL