Hi all,
Have a couple questions regarding ffmpeg order of operations.
I have been using this command line to convert 1080p60 H.264 files to 1080i60 XDCAM EX files
This works great, however I sometimes run into cases where I need to convert 720p60 files into 1080i60. Basically I want to scale up the video, convert to interlace while maintaining the temporal motion. The problem with that code is that it converts the video to interlace before scaling the video. This obviously causes a problem. Is there a way to reorder the operations so that it scales the video first and then interlaces the video?Code:ffmpeg.exe -i input.mp4 -pix_fmt yuv420p -vcodec mpeg2video -vf tinterlace=4 -flags +ildct+ilme -top 1 -dc 10 -qmin 1 -lmin "1*QP2LAMBDA" -vtag xdv3 -b:v 35000k -minrate 20000k -maxrate 35000k -bufsize 36408333 -g 15 -bf 2 -aspect 16:9 -r 29.97 -s 1920x1080 -async 2 -acodec pcm_s16le -ar 48000 -f mov -y "output.mp4"
Also, to make matters more complicated, I occasionally get footage that is vertical, which I need to scale to 1920x1080 and pad the sides out to maintain the aspect ratio of the original video. I use this command line to do this.
Now I would like to be able to take videos recorded at 720x1280p60 (vertical) and convert them to 1920x1080i60, again maintaining the temporal motion as well as padding out the sides.Code:ffmpeg.exe -i input.mp4-vf "scale=iw*sar:ih, pad=max(iw\,ih*(16/9)):ow/(16/9):(ow-iw)/2:(oh-ih)/2" -pix_fmt yuv420p -vcodec mpeg2video -flags +ildct+ilme -top 1 -dc 10 -qmin 1 -lmin "1*QP2LAMBDA" -vtag xdv3 -b:v 35000k -minrate 20000k -maxrate 35000k -bufsize 36408333 -g 15 -bf 2 -aspect 16:9 -r 29.97 -s 1920X1080 -async 2 -acodec pcm_s24le -ar 48000 -f mov -y "output.mp4"
Is this possible at all?
+ Reply to Thread
Results 1 to 13 of 13
-
-
Add a video scale before the interlace filter, "scale=w=1920:h=1080". And remove the later scale and frame rate arguments.
-
Any reason to get rid of the frame rate arguments? The scaling worked by the way, thanks!
-
Also, one last question...If I want to scale up 480i60 video to 1080i, is my only option to deinterlace and reinterlace?
I know I could do it using an avisynth script, but I'd like to keep it all within an ffmpeg command line. I'm ok if the quality is not going to be as good as using avisynth. I'm basically looking for a quick and dirty way of upscaling 480i content. -
quick and dirty way is to use interlace aware scaling flag "interl=1" , and the in/out colormatrix from 601 to 709 for SD to HD color
Code:-vf scale=w=1920:h=1080:interl=1:in_color_matrix=bt601:out_color_matrix=bt709
-
I would avoid scaling like that with ffmpeg. It's basically the same as SeparateFields().Upscale(1920,540).Weave() -- a very poor way of upscaling interlaced video unless it's very fuzzy to start with. It will leave nasty artifacts on sharp horizontal edges. Here's an example, a still frame:
480i:
[Attachment 40417 - Click to enlarge]
1080i:
[Attachment 40418 - Click to enlarge]
Be sure to view those images at full size. You're much better off with
Code:QTGMC() # or Yadif(mode=1) Upscale(1920,1080) SeparateFields() SelectEvery(4,0,3) Weave()
-
Yes, that's terrible, nice illustration jagabo.
Or you can use yadif double rate , resize, tinterlace (or interlace) , colormatrix in a linear filter chain with ffmpeg
Code:-vf yadif=mode=1,scale=w=1920:h=1080:in_color_matrix=bt601:out_color_matrix=bt709,tinterlace=4
Code:-vf yadif=mode=1,scale=w=1920:h=1080:in_color_matrix=bt601:out_color_matrix=bt709:sws_flags=lanczos,tinterlace=4
Last edited by poisondeathray; 29th Jan 2017 at 19:28.
-
thanks guys, I appreciate it. using interl=1 will be just fine for what I need it for. Normally yes, I always use avisynth, qtgmc etc for any project that needs the utmost quality. This is just for a batch encoding tool that may on the rare occasion see an interlaced file that needs to be upscaled....so I'm not too concerned with having the best quality.
-
Yes, that's much better:
[Attachment 40419 - Click to enlarge] -
You can use alternate resizer - 'zscale' - should provide better quality than native ffmpeg.
You should avoid specifying incorrect frame rate - that's why you should rid frame rate argument 29.97 is wrong framerate, correct one is 30000/1001 (approx 29.97002997002997..002997..002997..)
Similar Threads
-
ffmpeg scaling video resolution
By marcorocchini in forum Newbie / General discussionsReplies: 7Last Post: 26th Feb 2017, 09:25 -
HCencoder giving my progressive footage a field order
By kieranvyas in forum Authoring (DVD)Replies: 4Last Post: 3rd Sep 2015, 19:05 -
VirtualDub should do 2 simply operations but
By marcorocchini in forum Newbie / General discussionsReplies: 31Last Post: 25th Sep 2014, 16:50 -
how to invert field order with ffmpeg
By marcorocchini in forum Newbie / General discussionsReplies: 7Last Post: 18th Jun 2014, 21:19 -
AviSynth Order of Operations
By Gramps in forum RestorationReplies: 11Last Post: 2nd Jul 2012, 04:47