Answers.Body: <p>There's no such option for audio in MP4. MKV uses a fixed timescale of 1000 which is why audio has that tbn. In MP4, ffmpeg will set it to the sample rate.</p>
  <p>The latter is precise.
  Notice the timestamps for audio in MKV are not evenly spaced:</p>
  <pre><code>pts=0|pts_time=0.000000
  pts=21|pts_time=0.021000
  pts=43|pts_time=0.043000
  pts=64|pts_time=0.064000
  </code></pre>
  <p>Compare with MP4, which are:</p>
  <pre><code>pts=0|pts_time=0.000000
  pts=1024|pts_time=0.021333
  pts=2048|pts_time=0.042667
  pts=3072|pts_time=0.064000
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-05-11T18:08:51.113Z
Answers.Text: Note that even though you said _There's no such option for audio in MP4_, it can be done. It's just that it's not implemented.
Answers.UserDisplayName: kwjsksai
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-02-24T04:14:53.580Z
Answers.LastActivityDate: 2023-02-24T04:14:53.580Z
Answers.UserDisplayName: Gyan
Body: <p>I changed my video container with:<br />
  <code>ffmpeg -hide_banner -y -i in.mkv -c copy -video_track_timescale 1k out.mp4</code><br />
  But video_track_timescale only changes video tbn, not audio tbn.</p>
  <p>To check it:<br />
  <code>ffprobe -hide_banner .\in.mkv -read_intervals %+0.3 -show_entries frame=media_type,key_frame,pts,pts_time,pkt_duration,pkt_size -print_format compact</code></p>
  <pre><code>frame|media_type=video|key_frame=1|pts=0|pts_time=0.000000|pkt_duration=16|pkt_size=203501|side_data|
  side_data|
  
  frame|media_type=audio|key_frame=1|pts=0|pts_time=0.000000|pkt_duration=N/A|pkt_size=622
  frame|media_type=video|key_frame=0|pts=17|pts_time=0.017000|pkt_duration=16|pkt_size=5333
  frame|media_type=audio|key_frame=1|pts=21|pts_time=0.021000|pkt_duration=21|pkt_size=551
  frame|media_type=video|key_frame=0|pts=33|pts_time=0.033000|pkt_duration=16|pkt_size=1221
  frame|media_type=audio|key_frame=1|pts=43|pts_time=0.043000|pkt_duration=21|pkt_size=538
  frame|media_type=video|key_frame=0|pts=50|pts_time=0.050000|pkt_duration=16|pkt_size=12132
  frame|media_type=audio|key_frame=1|pts=64|pts_time=0.064000|pkt_duration=21|pkt_size=662
  </code></pre>
  <p><code>ffprobe -hide_banner .\out.mp4 -read_intervals %+0.3 -show_entries frame=media_type,key_frame,pts,pts_time,pkt_duration,pkt_size -print_format compact</code></p>
  <pre><code>frame|media_type=video|key_frame=1|pts=0|pts_time=0.000000|pkt_duration=16|pkt_size=203501|side_data|
  side_data|
  
  frame|media_type=audio|key_frame=1|pts=0|pts_time=0.000000|pkt_duration=1024|pkt_size=622
  frame|media_type=video|key_frame=0|pts=17|pts_time=0.017000|pkt_duration=16|pkt_size=5333
  frame|media_type=audio|key_frame=1|pts=1024|pts_time=0.021333|pkt_duration=1024|pkt_size=551
  frame|media_type=video|key_frame=0|pts=33|pts_time=0.033000|pkt_duration=16|pkt_size=1221
  frame|media_type=audio|key_frame=1|pts=2048|pts_time=0.042667|pkt_duration=1024|pkt_size=538
  frame|media_type=video|key_frame=0|pts=50|pts_time=0.050000|pkt_duration=16|pkt_size=12132
  frame|media_type=audio|key_frame=1|pts=3072|pts_time=0.064000|pkt_duration=1024|pkt_size=662
  </code></pre>
  <p>As we can see, in in.mkv, tbn is same for both audio/video aka 1k. But in out.mp4, tbn is different. Video has 1k tbn because I set it with -video_track_timescale, but where's the similar option for audio?</p>
  
Tags: <ffmpeg><audio><mp4>
Title: ffmpeg how to change audio tbn
UserDisplayName: kwjsksai
ThreadText: # ffmpeg how to change audio tbn
  
  (Asked by: username_0 on 2023-02-23)
  
  I changed my video container with:  
  `ffmpeg -hide_banner -y -i in.mkv -c copy -video_track_timescale 1k out.mp4`  
  But video\_track\_timescale only changes video tbn, not audio tbn.
  
  To check it:  
  `ffprobe -hide_banner .\in.mkv -read_intervals %+0.3 -show_entries frame=media_type,key_frame,pts,pts_time,pkt_duration,pkt_size -print_format compact`
  
  ```
  frame|media_type=video|key_frame=1|pts=0|pts_time=0.000000|pkt_duration=16|pkt_size=203501|side_data|
  side_data|
  
  frame|media_type=audio|key_frame=1|pts=0|pts_time=0.000000|pkt_duration=N/A|pkt_size=622
  frame|media_type=video|key_frame=0|pts=17|pts_time=0.017000|pkt_duration=16|pkt_size=5333
  frame|media_type=audio|key_frame=1|pts=21|pts_time=0.021000|pkt_duration=21|pkt_size=551
  frame|media_type=video|key_frame=0|pts=33|pts_time=0.033000|pkt_duration=16|pkt_size=1221
  frame|media_type=audio|key_frame=1|pts=43|pts_time=0.043000|pkt_duration=21|pkt_size=538
  frame|media_type=video|key_frame=0|pts=50|pts_time=0.050000|pkt_duration=16|pkt_size=12132
  frame|media_type=audio|key_frame=1|pts=64|pts_time=0.064000|pkt_duration=21|pkt_size=662
  
  ```
  
  `ffprobe -hide_banner .\out.mp4 -read_intervals %+0.3 -show_entries frame=media_type,key_frame,pts,pts_time,pkt_duration,pkt_size -print_format compact`
  
  ```
  frame|media_type=video|key_frame=1|pts=0|pts_time=0.000000|pkt_duration=16|pkt_size=203501|side_data|
  side_data|
  
  frame|media_type=audio|key_frame=1|pts=0|pts_time=0.000000|pkt_duration=1024|pkt_size=622
  frame|media_type=video|key_frame=0|pts=17|pts_time=0.017000|pkt_duration=16|pkt_size=5333
  frame|media_type=audio|key_frame=1|pts=1024|pts_time=0.021333|pkt_duration=1024|pkt_size=551
  frame|media_type=video|key_frame=0|pts=33|pts_time=0.033000|pkt_duration=16|pkt_size=1221
  frame|media_type=audio|key_frame=1|pts=2048|pts_time=0.042667|pkt_duration=1024|pkt_size=538
  frame|media_type=video|key_frame=0|pts=50|pts_time=0.050000|pkt_duration=16|pkt_size=12132
  frame|media_type=audio|key_frame=1|pts=3072|pts_time=0.064000|pkt_duration=1024|pkt_size=662
  
  ```
  
  As we can see, in in.mkv, tbn is same for both audio/video aka 1k. But in out.mp4, tbn is different. Video has 1k tbn because I set it with -video\_track\_timescale, but where's the similar option for audio?
  
  **Tags:** ffmpeg, audio, mp4
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2023-02-24. Score: 1 | Accepted answer
  
  There's no such option for audio in MP4. MKV uses a fixed timescale of 1000 which is why audio has that tbn. In MP4, ffmpeg will set it to the sample rate.
  
  The latter is precise.
  Notice the timestamps for audio in MKV are not evenly spaced:
  
  ```
  pts=0|pts_time=0.000000
  pts=21|pts_time=0.021000
  pts=43|pts_time=0.043000
  pts=64|pts_time=0.064000
  
  ```
  
  Compare with MP4, which are:
  
  ```
  pts=0|pts_time=0.000000
  pts=1024|pts_time=0.021333
  pts=2048|pts_time=0.042667
  pts=3072|pts_time=0.064000
  
  ```
  
  > **Comments:**
  > **username_0**: Note that even though you said _There's no such option for audio in MP4_, it can be done. It's just that it's not implemented.  
  
  ---
  
  