user17228: I am looking for a Windows based open source method to extract specific frames from video files (*.avi). Ideally the method will be suited to R.
I need to do this as I have annotated (many) video files using Solomon Coder. This is an open source program which, quickly and easily, allows for user specified frame by frame annotation.
I have then summarized the data using R. In my summary I have a behaviour event and the start and end frame numbers. I also have the start and end time in seconds, epoch time and as a POSIXct object.
I'd like to extract the specific frames in some instances.
I am aware of the following options:

ffmpeg in Matlab. However, I do not have access to Matlab nor I am that competent using it.
Using the command prompt and VLC. However, many images seem to get skipped and one ends up with lots of corrupt files. (e.g: https://www.raymond.cc/blog/extract-video-frames-to-images-using-vlc-media-player/)
Potentially calling Octave through R and using similar approach of ffmpeg. Again, this is a bit beyond my ability for the moment.

If anyone has some quick guidance that would be greatly appreciated.

user19853: You can also use: 
ffmpeg -ss XXX -i input.mp4 -vframes 1 output.png

where XXX is the time in seconds. If you know which exactly frame you want to extract you can calculate the XXX by multiplying the number of the wanted frame * frame duration which is 1/fps. 
Please also note that since H.264 is using I, P and B frames it would be best if you first decode your video to some intra-frame codec or raw. You can easily do that by: 
ffmpeg -i input.mp4 -vsync 0 output.y4m

And then you can extract the desired frame. But y4m is a format with no compression which means that the output file will be huge. You can also use ffv1 to do that since it is lossless codec, but make sure you use -g 1 option, since you need only I-frames at the output. 

user1871: To extract frame # x through y, use
ffmpeg -i in.mp4 -vf select='between(n\,x\,y)' -vsync 0 frames%d.png


17228: <p>I am looking for a Windows based open source method to extract specific frames from video files (*.avi). Ideally the method will be suited to R.</p>

<p>I need to do this as I have annotated (many) video files using Solomon Coder. This is an open source program which, quickly and easily, allows for user specified frame by frame annotation.</p>

<p>I have then summarized the data using R. In my summary I have a behaviour event and the start and end frame numbers. I also have the start and end time in seconds, epoch time and as a POSIXct object.</p>

<p>I'd like to extract the specific frames in some instances.</p>

<p>I am aware of the following options:</p>

<ol>
<li><p>ffmpeg in Matlab. However, I do not have access to Matlab nor I am that competent using it.</p></li>
<li><p>Using the command prompt and VLC. However, many images seem to get skipped and one ends up with lots of corrupt files. (e.g: <a href="https://www.raymond.cc/blog/extract-video-frames-to-images-using-vlc-media-player/" rel="nofollow noreferrer">https://www.raymond.cc/blog/extract-video-frames-to-images-using-vlc-media-player/</a>)</p></li>
<li><p>Potentially calling Octave through R and using similar approach of ffmpeg. Again, this is a bit beyond my ability for the moment.</p></li>
</ol>

<p>If anyone has some quick guidance that would be greatly appreciated.</p>
 19853: <p>You can also use: </p>

<pre><code>ffmpeg -ss XXX -i input.mp4 -vframes 1 output.png
</code></pre>

<p>where XXX is the time in seconds. If you know which exactly frame you want to extract you can calculate the XXX by multiplying the number of the wanted frame * frame duration which is 1/fps. </p>

<p>Please also note that since H.264 is using I, P and B frames it would be best if you first decode your video to some intra-frame codec or raw. You can easily do that by: </p>

<pre><code>ffmpeg -i input.mp4 -vsync 0 output.y4m
</code></pre>

<p>And then you can extract the desired frame. But y4m is a format with no compression which means that the output file will be huge. You can also use ffv1 to do that since it is lossless codec, but make sure you use <code>-g 1</code> option, since you need only I-frames at the output. </p>
 1871: <p>To extract frame # <code>x</code> through <code>y</code>, use</p>

<pre><code>ffmpeg -i in.mp4 -vf select='between(n\,x\,y)' -vsync 0 frames%d.png
</code></pre>
