Adding anamorphic details back after they have been lost

General questions or discussion about HandBrake, Video and/or audio transcoding, trends etc.
Post Reply
pf_moore
Posts: 13
Joined: Mon Jul 26, 2010 9:12 pm

Adding anamorphic details back after they have been lost

Post by pf_moore » Mon Jul 26, 2010 9:28 pm

I use Handbrake to convert files recorded off my PVR to M4V format. The conversion nicely creates files with anamorphic information set "properly" (i.e., the files play as widescreen in VLC). However, if I want to cut out ads, I use avidemux to do this - I can use the avidemux "copy" option to avoid re-encoding, so that's both fast and doesn't lose quality. But avidemux strips the anamorphic information (i.e., the cut file plays non-widescreen). Is it possible to add the anamorphic information back into the file without re-encoding - either using Handbrake, or using a 3rd party tool? From what I am able to follow of the discussions of anamorphic information, it's simply a metadata setting, and doesn't affect the stored pixel data - at least, not unless you're using loose anamorphic and need to adjust the storage data to make it a multiple of 16 pixels (not an issue if I'm working on pixel data that was encoded using loose anamorphic in the first place).

Sorry if this is a dumb question - if it is, I'd appreciate an explanation of what I've missed, as that way I'll learn something useful, at least :)

Paul.

User avatar
Rodeo
HandBrake Team
Posts: 12248
Joined: Tue Mar 03, 2009 8:55 pm

Re: Adding anamorphic details back after they have been lost

Post by Rodeo » Tue Jul 27, 2010 10:39 am

You can use anamorphic custom in HandBrake, or Subler (Mac) for MP4, Mkvtoolnix (cross-platform) for MKV if you want to fix it after-the-fact.

mduell
Veteran User
Posts: 6720
Joined: Sat Apr 21, 2007 8:54 pm

Re: Adding anamorphic details back after they have been lost

Post by mduell » Tue Jul 27, 2010 7:05 pm

pf_moore wrote:Is it possible to add the anamorphic information back into the file without re-encoding - either using Handbrake, or using a 3rd party tool?
HandBrake won't do anything without re-encoding the video. But when you do re-encode with HB you can use custom anamorphic.

pf_moore
Posts: 13
Joined: Mon Jul 26, 2010 9:12 pm

Re: Adding anamorphic details back after they have been lost

Post by pf_moore » Tue Jul 27, 2010 7:36 pm

mduell wrote:HandBrake won't do anything without re-encoding the video. But when you do re-encode with HB you can use custom anamorphic.
OK, Thanks. So there's no way of getting the anamorphic back without re-encoding. Pity. I guess I might as well re-encode adding anamorphic while I cut in avidemux, then. (Actually, if I have to encode in avidemux to allow me to cut, it might not be worth including Handbrake in the process at all. Is Handbrake's anamorphic support superior to the way avidemux handles anamorphic data - which seems to involve setting a pixel aspect ratio on encoding?)

Paul

mkelley
Bright Spark User
Posts: 389
Joined: Fri Dec 25, 2009 2:00 am

Re: Adding anamorphic details back after they have been lost

Post by mkelley » Tue Jul 27, 2010 7:49 pm

As Rodeo said, you can use a tool like mkvmerge to get anamorphic back without re-encoding (it just remuxes things, but that only takes a few minutes). Then use Handbrake if you need to reduce the final output size.

pf_moore
Posts: 13
Joined: Mon Jul 26, 2010 9:12 pm

Re: Adding anamorphic details back after they have been lost

Post by pf_moore » Tue Jul 27, 2010 11:01 pm

mkelley wrote:As Rodeo said, you can use a tool like mkvmerge to get anamorphic back without re-encoding (it just remuxes things, but that only takes a few minutes). Then use Handbrake if you need to reduce the final output size.
Sorry, I'd seen that response but hadn't commented. Subler is Mac-only, mkvmerge is for mkv files. I'm using mp4 on Windows, so neither applies. I guess I could use mkv as my container format, I don't have to use mp4, I just had the impression that it's recognised by more applications.

But thanks to the hint I went on a search and found mp4box, which appears to do precisely what I want. See http://blog.komeil.com/2006/09/modify-m ... mpeg4.html for some details. I'll need to do some experimenting, but I think I now have what I need.

Thanks for the help!

musicvid
Veteran User
Posts: 3330
Joined: Sat Jun 27, 2009 1:19 am

Re: Adding anamorphic details back after they have been lost

Post by musicvid » Wed Jul 28, 2010 6:45 pm

Try the VideoReDo h.264 Beta version. It uses a time-proven method of removing commercials, re-indexing GOPs, and joining segments without rendering the video.
However, as a beta, h.264 implementation isn't quite ready for prime time, but good enough to give you an idea of what you can do.

Bling2Ming
Regular User
Posts: 104
Joined: Mon Dec 29, 2008 10:03 pm

Re: Adding anamorphic details back after they have been lost

Post by Bling2Ming » Wed Jul 28, 2010 9:36 pm

Yes the command line tool MP4Box can indeed add the correct PAR back to an MP4/M4V file without the need for re-encoding.
The syntax is :

Code: Select all

MP4Box -par 1=X:Y YourVideo.mp4
The 1 is the track number of the video track we assume its 1.

X = ((desired display aspect * pixel height) / pixel width) * 100

Y = 100

Example:

If we have a 720x480 pixel mp4 file and at a par of 1:1 the video displays at 3:2 or 1.5:1 but we require the file to display at 16:9 in VLC then the numbers we need are:

X = ((16/9) * 480)/ 720 x 100 = 118.52 (Round this up to 119)

Y = 100

So the command would be:

Code: Select all

MP4Box -par 1=119:100 YourVideo.mp4

jamiemlaw
Veteran User
Posts: 536
Joined: Thu Sep 17, 2009 4:52 pm

Re: Adding anamorphic details back after they have been lost

Post by jamiemlaw » Wed Jul 28, 2010 10:43 pm

I assume Y doesn't always have to be 100. For the above scenario, I take it that 32:27 would work just as well?

Bling2Ming
Regular User
Posts: 104
Joined: Mon Dec 29, 2008 10:03 pm

Re: Adding anamorphic details back after they have been lost

Post by Bling2Ming » Thu Jul 29, 2010 5:11 am

jamiemlaw wrote:I assume Y doesn't always have to be 100. For the above scenario, I take it that 32:27 would work just as well?

Yes that's correct I use 100 for the Y value as a fudge so I don't have to work out both X and Y it helps me if I'm dealing with a variety of different source material.

Post Reply