You have to do this with the help of an application. The software's name is QGifer. You can download it for free from its application's page at Sourceforge. Download, install the application, then press CTRL + SHIFT + V to select a video file. Supports AVI, MP4, MPG, OGV file formats. Once the video is opened, press the START button to mark the start position then use the END button to mark the stop position. After this process, configure any other details using the menu on the left and finally press on Extract GIF. Wait for its generation and another window will be opened from where you can save the GIF file and that's it. Use the image below to see exactly how it's done.
