Igor Grinfeld
Igor Grinfeld

Reputation: 598

How to change stream metadata with ffmpeg?

I have many video files and part of it have wrong size, or at least ffmpeg reports wrong size. For example, ffmpeg prints:

 Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42isom
    creation_time   : 2009-10-11 15:04:33
    encoder         : HandBrake 0.9.3 2008112300
 Duration: 01:47:42.18, start: 0.000000, bitrate: 663 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 720x464 [
SAR 43:36 DAR 215:116], 499 kb/s, 25 fps, 25 tbr, 48k tbn, 50 tbc
 Metadata:
    creation_time   : 2009-10-11 15:04:33
    handler_name    :
 Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, s16, 159
kb/s
 Metadata:
     creation_time   : 2009-10-11 15:04:33
     handler_name    :

However, when I configure media player to play the file without resizing it has 860x464 size.

I want to write scripts that will fix the files, but I don't know how to do that. I've updated to last ffmpeg version and tried to use -metadata:s:v:0 Video="...860x464...", as I read in ffmpegh doc, but it doesn't work. What is my mistake?

Upvotes: 3

Views: 2539

Answers (1)

Zombo
Zombo

Reputation: 1

You are probably dealing with Anamorphic widescreen.

The "true" dimensions of the video are 860x464, which comes out to a 1.85:1 aspect ratio. The trouble is that DVD image frame have these max sizes.

  • PAL 720x576
  • NTSC 720x480

If this video was resized while maintaining aspect ratio, you get 720x388. Instead of doing that the author records at 720x464. This way you fit in the dimensions and maximize the quality. Obviously, recording like this messes up the aspect ratio. Anamorphic video has a "switch" inside it; when the DVD reads this switch it expands the video horizontally to 860x464.

Links

Upvotes: 2

Related Questions