<p>Add <code>-video_track_timescale X</code> to manually set a timescale of X.</p>
<p><code>ffmpeg -i org_video_1280x720.mp4 -strict -2 -vf &quot;scale=640:360&quot; -video_track_timescale 90k new_video_640x360.mp4</code></p>

CC BY-SA 4.0
2021-01-21T16:46:53.153Z
Thanks @Gyan. Now with this option the `tbn` was fixed and the resulted stream was - `25 fps, 25 tbr, 30k tbn, 50 tbc`; However, here the `tbc` value was new and it didn't change back to original - `25 fps, 25 tbr, 30k tbn, 60k tbc`.
Muthu Thavamani
CC BY-SA 4.0
2021-01-21T16:49:37.377Z
so when I merge this video with others videos those has stream -  `Stream #0:1(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x360, 812 kb/s, 25 fps, 25 tbr, 30k tbn, 60k tbc (default)` the resulted video has the same error while playing. And while concat process in terminal i got warning says `Non-monotonous DTS in output stream 0:1; previous: 4016128, current: 3765360; changing to 4016129. This may result in incorrect timestamps in the output file`.
Muthu Thavamani
CC BY-SA 4.0
2021-01-21T16:51:03.160Z
i hope this video error and warning was due to the `tbc` mismatch.
Muthu Thavamani
CC BY-SA 4.0
2021-01-21T14:52:25.197Z
2021-01-21T14:52:25.197Z
Gyan
<p>I have been trying to write a script to merge multiple <code>.mp4</code> videos using ffmpeg. As part of this process, while trying to alter the size found that it alters the timebase. However, for <code>ffmpeg - concat demux</code> all streams should be same or else after merge only the first part of the video plays well and stops abruptly.</p>
<p>I have tried both terminal way and also using <code>fluent-ffmpeg</code>. But unfortunately both gives same result.</p>
<ol>
<li>Original video Ex, org_video_1280x720.mp4</li>
</ol>
<blockquote>
<p>Stream #0:1(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720, 812 kb/s, 25 fps, 25 tbr, 30k tbn, 60k tbc (default)</p>
</blockquote>
<ol start="2">
<li>after scaling down to 640x360 via terminal <code>ffmpeg -i org_video_1280x720.mp4 -strict -2 -vf &quot;scale=640:360&quot; new_video_640x360.mp4</code></li>
</ol>
<blockquote>
<p>Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x360, 256 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)</p>
</blockquote>
<ol start="3">
<li>The fluent-ffmpeg way of sizing</li>
</ol>
<pre><code>ffmpeg(`/path/to/org_video_1280x720.mp4`).size(`640x360`). autopad().output(`/path/to/new_video_640x360.mp4`)
          .on('error', function(err, stdout, stderr) {
              console.log('Error: ' + err.message);
              console.log('STD Err: ' + stderr);
         })
         .on('end', function() {
              console.log('Split &amp; Resizing Completed!');
         }).run();
</code></pre>
<blockquote>
<p>Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x360, 253 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)</p>
</blockquote>
<p>Notice the <code>tbn &amp; tbc</code> changes after resizing; Actually I have to merge this with other video only by changing the resolution (as they were with these <code>25 fps, 25 tbr, 30k tbn, 60k tbc</code> stream values); However as it alters the <code>time_base</code>, I was unable to do it. Hope, I am missing something in the process, as I am bit new to audio/video process. Looking for some tips/guidance to get this done!</p>

<video><ffmpeg>
ffmpeg - resizing .mp4 changes the timebase (tbn & tbc)
Muthu Thavamani
# ffmpeg - resizing .mp4 changes the timebase (tbn & tbc)

(Asked by: username_0 on 2021-01-21)

I have been trying to write a script to merge multiple .mp4 videos using ffmpeg. As part of this process, while trying to alter the size found that it alters the timebase. However, for ffmpeg - concat demux all streams should be same or else after merge only the first part of the video plays well and stops abruptly.
I have tried both terminal way and also using fluent-ffmpeg. But unfortunately both gives same result.

Original video Ex, org_video_1280x720.mp4


Stream #0:1(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720, 812 kb/s, 25 fps, 25 tbr, 30k tbn, 60k tbc (default)


after scaling down to 640x360 via terminal ffmpeg -i org_video_1280x720.mp4 -strict -2 -vf "scale=640:360" new_video_640x360.mp4


Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x360, 256 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)


The fluent-ffmpeg way of sizing

ffmpeg(`/path/to/org_video_1280x720.mp4`).size(`640x360`). autopad().output(`/path/to/new_video_640x360.mp4`)
          .on('error', function(err, stdout, stderr) {
              console.log('Error: ' + err.message);
              console.log('STD Err: ' + stderr);
         })
         .on('end', function() {
              console.log('Split & Resizing Completed!');
         }).run();


Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x360, 253 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)

Notice the tbn & tbc changes after resizing; Actually I have to merge this with other video only by changing the resolution (as they were with these 25 fps, 25 tbr, 30k tbn, 60k tbc stream values); However as it alters the time_base, I was unable to do it. Hope, I am missing something in the process, as I am bit new to audio/video process. Looking for some tips/guidance to get this done!

**Tags:** video, ffmpeg


---

## 1 answers

### Answer by username_1 on 2021-01-21. Score: 4

Add `-video_track_timescale X` to manually set a timescale of X.

`ffmpeg -i org_video_1280x720.mp4 -strict -2 -vf "scale=640:360" -video_track_timescale 90k new_video_640x360.mp4`

> **Comments:**
> **username_0**: Thanks @username_1. Now with this option the `tbn` was fixed and the resulted stream was - `25 fps, 25 tbr, 30k tbn, 50 tbc`; However, here the `tbc` value was new and it didn't change back to original - `25 fps, 25 tbr, 30k tbn, 60k tbc`.  
> **username_0**: so when I merge this video with others videos those has stream -  `Stream #0:1(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x360, 812 kb/s, 25 fps, 25 tbr, 30k tbn, 60k tbc (default)` the resulted video has the same error while playing. And while concat process in terminal i got warning says `Non-monotonous DTS in output stream 0:1; previous: 4016128, current: 3765360; changing to 4016129. This may result in incorrect timestamps in the output file`.  
> **username_0**: i hope this video error and warning was due to the `tbc` mismatch.  

---

