Answers.Body: <p>There is an open ticket against <a href="https://trac.ffmpeg.org/ticket/1349" rel="nofollow noreferrer">FFmpeg</a> from 4 years ago, that suggests that this is a bug with the mp4 container</p>
  
  <blockquote>
    <p>2) outfile has expected playback behavior with .ts and .mkv containers.<br/>
    3) It does not work with .avi (no timestamps, so not a surprise)
    4) It does not work with .mp4 container (a bug?)</p>
  </blockquote>
  
  <p>Sure enough, when I use an mkv file, it works.
  (Well, in VLC, but no sound at all in the Windows 10 "Films &amp; TV" viewer.)</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-11-07T05:41:05.823Z
Answers.LastActivityDate: 2016-11-07T05:41:05.823Z
Answers.UserDisplayName: Oddthinking
Answers.Body: <p>You can use the <code>adelay</code> filter for MP4.</p>
  
  <pre><code>ffmpeg -y -i soundtrack.wav -framerate 30 -i %d.png -af "adelay=28840|28840" -r 30 -vcodec mpeg4 generated.mp4
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-11-07T07:06:44.107Z
Answers.Text: Will try that out.
Answers.UserDisplayName: Oddthinking
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-11-07T11:07:14.177Z
Answers.Text: 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.
Answers.UserDisplayName: Oddthinking
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-11-07T11:29:29.133Z
Answers.Text: It is likely a bug. Try with `-copyts` immediately after the itsoffset.
Answers.UserDisplayName: Gyan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-10T09:37:13.787Z
Answers.Text: Apparently itsoffset only works for video inputs, not audio
Answers.UserDisplayName: Danny
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-10T10:03:15.477Z
Answers.Text: Not so.  Unless the demuxer sends packets with no timestamps, itsoffset should work with all inputs
Answers.UserDisplayName: Gyan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-11-07T07:00:04.277Z
Answers.LastActivityDate: 2016-11-07T07:00:04.277Z
Answers.UserDisplayName: Gyan
Body: <p>When rendering my animation video with ffmpeg, I want my video to start with 28-odd seconds of silencebefore the soundtrack begins. </p>
  
  <p>(Well, I really want it to be 0.28 seconds but making it longer makes debugging easier.)</p>
  
  <p>That's easy enough. According to <a href="https://ffmpeg.org/ffmpeg.html" rel="nofollow noreferrer">the manual</a> and <a href="https://superuser.com/questions/982342/in-ffmpeg-how-to-delay-only-the-audio-of-a-mp4-video-without-converting-the-au">SuperUser</a> and <a href="http://alien.slackbook.org/blog/fixing-audio-sync-with-ffmpeg/" rel="nofollow noreferrer">others</a>, it is all about adding the <code>-itsoffset</code> parameter before the audio input you wish to delay.</p>
  
  <p>Here's my command line:</p>
  
  <pre><code>ffmpeg -y -itsoffset 28.84 -i soundtrack.wav -framerate 30 -i %d.png -r 30 -vcodec mpeg4 generated.mp4
  </code></pre>
  
  <p>It generates the video, but the soundtrack starts immediately.</p>
  
  <p>I am stll new to FFmpeg, so I assume I am missing something obvious.</p>
  
Tags: <ffmpeg>
Title: The -itsoffset parameter of FFmpeg is having no effect
UserDisplayName: Oddthinking
ThreadText: # The -itsoffset parameter of FFmpeg is having no effect
  
  (Asked by: username_0 on 2016-11-07)
  
  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](https://ffmpeg.org/ffmpeg.html) and [SuperUser](https://superuser.com/questions/982342/in-ffmpeg-how-to-delay-only-the-audio-of-a-mp4-video-without-converting-the-au) and [others](http://alien.slackbook.org/blog/fixing-audio-sync-with-ffmpeg/), 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.
  
  **Tags:** ffmpeg
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2016-11-07. Score: 2 | Accepted answer
  
  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
  
  ```
  
  > **Comments:**
  > **username_0**: Will try that out.  
  > **username_0**: 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.  
  > **username_1**: It is likely a bug. Try with `-copyts` immediately after the itsoffset.  
  > **username_2**: Apparently itsoffset only works for video inputs, not audio  
  > **username_1**: Not so.  Unless the demuxer sends packets with no timestamps, itsoffset should work with all inputs  
  
  ---
  
  ### Answer by username_0 on 2016-11-07. Score: 1
  
  There is an open ticket against [FFmpeg](https://trac.ffmpeg.org/ticket/1349) 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.)
  
  
  ---
  
  