VideoHelp Forum
+ Reply to Thread
Results 1 to 4 of 4
Thread
  1. 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 $outfile
    the 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))'"
    ... -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"
    hope someone has some ideas.

    thanks.
    Quote Quote  
  2. doesn't
    Code:
    -vf bwdif=0 -r 1
    or
    Code:
    -vf bwdif=0,fps=fps=1
    do the job?

    Not testing your command lines since you didn't even bother to post the errors.
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  3. Originally Posted by Selur View Post
    doesn't
    Code:
    -vf bwdif=0 -r 1
    or
    Code:
    -vf bwdif=0,fps=fps=1
    do the job?
    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()`.

    Originally Posted by Selur View Post
    Not testing your command lines since you didn't even bother to post the errors.
    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.
    Quote Quote  
  4. 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
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!