Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have an audio(REC00006.wav) of 6 seconds duration. I have a video(SUNP.avi) of 17 seconds duration.

I need to merge these two files,but the audio should come from the 11th to 17th second of the video.

I include the code here. Merging is success. But audio is coming from the start of video

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

Here is the console output.

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
share|improve this question
    
Please provide the console output as well. –  Rajib Mar 6 at 13:47

1 Answer 1

Use this:

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

You only need the -y once at the beginning to overwrite existing file with same output name. The itsoffset parameter must be in HH:MM:SS format or HH:MM:SS.DECIMAL format.

share|improve this answer
    
Yes i tried. Still the audio is playing from the beginning of video. –  user1665130 Mar 7 at 3:04
    
Please provide the output of this command as well, along with the command. Edit your question to add this command with the itsoffset in the new format. –  Rajib Mar 7 at 3:09
    
yes Rajib. Edited the question with new console output –  user1665130 Mar 7 at 3:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.