hi all,
i'm trying to write a shell script to analyse some videos by using the first frame of each second of video as a basis. i'm using ffmpeg to extract the frames. my script works ok if the video is progressive, but doesn't work so well for interleaved video (only the first field is output in that case, creating a half-height image). i've tried various combinations of deinterlacing (`yadif/bwdif`) with `select` but the filter chains i create either cause errors or still return a half-sized image. can someone help me with the syntax ?
here is my call w/a filter that works correctly for progressive video source :ffmpeg -i $infile -vf "select='if(eq(n\,0),1,floor(t)-floor(prev_selected_t))" -vsync 0 $outfilethe following still return only half-height images for interlaced source :... -vf "bwdif=0,select='if(eq(n\,0),1,floor(t)-floor(prev_selected_t))'"hope someone has some ideas.
... -vf "bwdif=0,select='between(mod(n\,$ips)\,1\,2)'" -- $ips is images per second
... -vf "select='between(mod(n\,$ips)\,1\,2)',bwdif=0"
thanks.
+ Reply to Thread
Results 1 to 4 of 4
-
-
doesn't
Code:-vf bwdif=0 -r 1
Code:-vf bwdif=0,fps=fps=1
Not testing your command lines since you didn't even bother to post the errors.users currently on my ignore list: deadrats, Stears555, marcorocchini -
no, unfortunately the resulting output is still only half-height. it doesn't look like the bwdif filter is being called into play before frame selection. additionally this approach won't work w/variable frame-rate video, which is why i settled on using a time-based approach w/`select()`.
er... i "didn't even bother to post the errors" because there were no errors relative to these snippets to post. errors for other attempts were self-explanatory and weren't germane to this approach, so i didn't include them here. the principal problem w/these approaches, as indicated in the OP, were that the output frames are only half-height instead of full frames. -
it turns out the solution is to use the tinterlace filter first. the full command line that worked was :
Code:ffmpeg -i $infile -vf "tinterlace=mode=merge,bwdif=0,select='if(eq(n\,0),1,floor(t)-floor(prev_selected_t))" -vsync 0 $outfile
Similar Threads
-
How to extract video/audio/script from MKV to later use in Premiere?
By afjka in forum Newbie / General discussionsReplies: 2Last Post: 10th Oct 2020, 16:11 -
Need ffmpeg help. Extract frame every 10 sec and do it in a batch.
By widuljewic in forum Newbie / General discussionsReplies: 5Last Post: 16th Jun 2020, 07:12 -
help needed can i rip a disc or extract the video files like in the 1st pic
By elm in forum EditingReplies: 1Last Post: 16th Mar 2020, 03:11 -
ffmpeg: most efficient way to extract frame ranges?
By chconnor in forum Video ConversionReplies: 6Last Post: 27th Feb 2018, 02:16 -
Use ffmpeg to replace frame with previous frame if frames are X % different
By dkrichards16 in forum Video ConversionReplies: 0Last Post: 29th Apr 2017, 16:27