FORUMS: list search recent posts

2:40 mask

COW Forums : FFmpeg

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
len hugh
2:40 mask
on Jan 15, 2015 at 8:44:58 am

I have a 1920x1080 picture and I want to add a 2:40 mask using ffmpeg.
I don't want to crop it I just want to mask for 2:40
does anyone have a suggestion on the best way to go about this?
thanks in advance
L


Return to posts index

Mark Burton
Re: 2:40 mask
on Mar 5, 2015 at 8:41:57 pm

I've been using this for 1920x1080 input videos. Its crude but works fine for me. Its set to our specific 2.39 framing leader so you will need to tweak the three numbers (142, 2.41 and 145) to get exactly the mask you want. Easiest to just test it on your framing leader:
I'd love to know if there is a better way though or if you found another way?
-vf drawbox=x=-t:y=-t+142:w=iw+t*2:h=iw/2.41+t*2:t=145:c=black


Return to posts index

len hugh
Re: 2:40 mask
on Mar 6, 2015 at 2:51:02 am

Thanks for the code. I have not had time to play with other options. The only other way I can think to to it is to overlay a mask.

Its really a question of whats fastest. Ill run a test and see if there is a difference between your code and overlaying a mask and let you know.

I think your code sounds the best way, it saves having to have a png file or similar in a location and making sure it is there when the code runs.
I like it, thanks

cropping is another option but I worry that someone will try and bring the output file into another app and stretch the image without realizing.

looks to me like you have a similar occupation to me so while I have you could I ask you another question, (which I will post on its own in the forum later)
H264 and quicktime have always suffered from what is known as "the gamma bug" see this link for more info....
https://vitrolite.wordpress.com/2010/12/31/quicktime_gamma_bug/
how do you handle this if you are using H264 and delivering to clients?


Return to posts index


Mark Burton
Re: 2:40 mask
on Mar 6, 2015 at 5:37:52 pm

Like you I wanted to avoid using any external files for the mask. Plus this is quick and easy to tweak to get the mask you need and change if needed. It does have an encode time hit, but I imagine there is a similar if not higher hit from using an overlay. I also looked briefly as cropping and padding back to 16x9, but felt this was not as elegant as the drawbox route. Maybe its faster though?

With regards to the gamma issue, its a bit of a pain isn't it. We tend to watch all offline material in DNxHD and when we do send out H.264 its for cut review more than picture quality, so we mostly get away with it. Hopefully with x264 things will improve though.



Return to posts index

len hugh
Re: 2:40 mask
on Mar 15, 2015 at 7:49:20 am

Hey Mark,
FYI, thought you might be interested in this.

I ran some tests to create a 2.40 mask.
(I took a 100 min dnx38 mov and made a h264, with timecode and watermark being burnt in with drawtext.)

1. drawbox
2. overlay a png file
3. crop it and pad it back out to HD

surprising to me, it turns out draw box was the slowest, taking 50 mins
the overlay method took 45 mins
and the crop and pad took 37 mins

I then checked how long it would take without a crop at all and it was the same time as the crop and pad, 37mins.


Return to posts index

Mark Burton
Re: 2:40 mask
on Mar 16, 2015 at 2:43:51 pm

That is very interesting, thanks for testing those all out. I've been trying to put a filter string together to do crop and pad a 1920x1080 INPUT to 1280x720 OUTPUT, but am failing miserably at the moment. Can you give me any help with the crop and pad string you have working.

Many thanks
Mark


Return to posts index


len hugh
Re: 2:40 mask
on Mar 16, 2015 at 11:23:28 pm

Hey,

/usr/local/bin/ffmpeg -threads 0 -y -use_absolute_path 1 -i 'input.mov' -flags +global_header -c:v libx264 -pix_fmt yuv420p -b:v 1500k -preset fast -vf crop=1686:720:117:180,pad=width=1920:height=1080:x=117:y=180:color=black -c:a libfdk_aac -b:a 128k "crop_out.mp4"

so i have cropped top and bottom and left and right. just to cover all the bases in my test.

there are probably a few flags in here that don't need to be there but its something that has evolved over a long time and I havent gone back to see what could go.
In my tests I had burn in TC and a watermark but I stripped out that for you.
I do get one error I cant seem to figure out. On some mov files I get this,

[swscaler @ 0x7ff971805800] Warning: data is not aligned! This can lead to a speedloss

in the terminal output but not all the time. the movs that work are exactly the same as the ones that dont ie dnx36 so I dont get why I only get it some times


Return to posts index

len hugh
Re: 2:40 mask
on Mar 16, 2015 at 11:46:37 pm

I added in a rescale and it worked. it seemed to work.
Altho I got that same error

[swscaler @ 0x7ff971805800] Warning: data is not aligned! This can lead to a speedloss

/usr/local/bin/ffmpeg -threads 0 -y -use_absolute_path 1 -i 'input.mov' -c:v libx264 -pix_fmt yuv420p -b:v 1500k -preset fast -vf crop=1686:720:117:180,scale=iw/1.5:-1,pad=width=1280:height=720:x=78:y=120:color=black "crop_out.mp4"


Return to posts index

Mark Burton
Re: 2:40 mask
on Mar 17, 2015 at 4:06:44 pm

Thanks Len, this is great. For me its halved my encode time, amazing! We also have a drawtext putting a spoiler over the picture and resulting in a 1280x720 file.

The next task is to work out how to get ffmpeg to read the infile's embedded timecode start value and somehow pass this to a drawtext filter set to burnin timecode. So far I've come up blank with all my searches.

Seems like it might not be a supported workflow with ffmpeg alone and may need to use something like ffprobe to grab the TC value before passing this onto an ffmpeg command. Possibly a two step applescript.

Are you working with infile embedded timecode at all?


Return to posts index


Mark Burton
Re: 2:40 mask
on Mar 17, 2015 at 10:26:59 pm

I just came across your post here:
https://forums.creativecow.net/thread/291/1369

Which seems to have exactly what I'm looking for with regards to the timecode data read.

Do you know of any OS X ffmbc binary builds that are available for direct download? Building the binary myself is pretty daunting since I've never done anything like that before.

Thanks


Return to posts index

len hugh
Re: 2:40 mask
on Mar 17, 2015 at 10:45:04 pm

Halved your encode time, thats great. even 10 or 20% time saved is well worth it when it comes time for mad turnovers.

re TC, yes, I have had some success.

maybe easier to contact me at whosofferingathotmaildotcom


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]