TOP
TOP

Reputation: 2624

Cropping video with FFmpeg increases the tbn value too much

Here is the information of original video:

 Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2016-04-05 03:00:09
  Duration: 00:01:50.09, start: 0.000000, bitrate: 8131 kb/s
    Stream #0:0(eng): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p(tv, bt470bg/bt470bg/smpte170m), 1920x1080, 7995 kb/s, SAR 1:1 DAR 16:9, 44.49 fps, 90k tbr, 90k tbn, 180k tbc (default)

Then I used this ffmpeg command to crop video:

ffmpeg -i file.mp4 -vf "crop=480:480:0:0" -b:v 2048k -preset ultrafast cropped.mp4

Here is the information of cropped video:

 Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.28.101
  Duration: 00:01:50.16, start: 0.023220, bitrate: 1078 kb/s
    Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 1282x716 [SAR 1:1 DAR 641:358], 1002 kb/s, 44.49 fps, 44.49 tbr, 220455000.00 tbn, 88.98 tbc (default)

The default video player of my phone cannot play this video. If I use MX Player I have to change the decoder to Software decoder (instead of Hardware) to open it.

I noticed that the tbn value was increased after reencoding. The old value is 90k. The new value is 220455k. Maybe it is the reason why the default video player doesn't work.

Question: why is the tbn value so big? How to avoid it?

Upvotes: 0

Views: 1134

Answers (1)

Gyan
Gyan

Reputation: 93329

You can specify the tbn for a MOV/MP4 file by using video_track_timescale:

ffmpeg -i file.mp4 -vf "crop=480:480:0:0" -b:v 2048k -preset ultrafast \
       -video_track_timescale 90000 cropped.mp4

(You may also need to try expressly setting an output framerate -r 45)

Upvotes: 1

Related Questions