0

When rendering my animation video with ffmpeg, I want my video to start with 28-odd seconds of silencebefore the soundtrack begins.

(Well, I really want it to be 0.28 seconds but making it longer makes debugging easier.)

That's easy enough. According to the manual and SuperUser and others, it is all about adding the -itsoffset parameter before the audio input you wish to delay.

Here's my command line:

ffmpeg -y -itsoffset 28.84 -i soundtrack.wav -framerate 30 -i %d.png -r 30 -vcodec mpeg4 generated.mp4

It generates the video, but the soundtrack starts immediately.

I am stll new to FFmpeg, so I assume I am missing something obvious.

1

You can use the adelay filter for MP4.

ffmpeg -y -i soundtrack.wav -framerate 30 -i %d.png -af "adelay=28840|28840" -r 30 -vcodec mpeg4 generated.mp4
  • Will try that out. – Oddthinking Nov 7 '16 at 7:06
  • Thanks. This worked. I still don't understand the reason why my way didn't work, and I have to assume it is a bug, but that could still be wrong. – Oddthinking Nov 7 '16 at 11:07
  • 1
    It is likely a bug. Try with -copyts immediately after the itsoffset. – Gyan Nov 7 '16 at 11:29
  • Apparently itsoffset only works for video inputs, not audio – Danny Jan 10 at 9:37
  • Not so. Unless the demuxer sends packets with no timestamps, itsoffset should work with all inputs – Gyan Jan 10 at 10:03
0

There is an open ticket against FFmpeg from 4 years ago, that suggests that this is a bug with the mp4 container

2) outfile has expected playback behavior with .ts and .mkv containers.
3) It does not work with .avi (no timestamps, so not a surprise) 4) It does not work with .mp4 container (a bug?)

Sure enough, when I use an mkv file, it works. (Well, in VLC, but no sound at all in the Windows 10 "Films & TV" viewer.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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