VideoHelp Forum
+ Reply to Thread
Page 1 of 2
1 2 LastLast
Results 1 to 30 of 45
Thread
  1. Member
    Join Date
    Jan 2012
    Location
    jordan
    Search Comp PM
    i need codes that can read a video stream and extract frames out of the stream, I,P,B frames , and i want it under windows,
    please any body can help me
    Quote Quote  
  2. aBigMeanie aedipuss's Avatar
    Join Date
    Oct 2005
    Location
    666th portal
    Search Comp PM
    don't post the same thing multiple times.
    --
    "a lot of people are better dead" - prisoner KSC2-303
    Quote Quote  
  3. Member
    Join Date
    Jan 2012
    Location
    jordan
    Search Comp PM
    sorry, but can u help me
    Quote Quote  
  4. aBigMeanie aedipuss's Avatar
    Join Date
    Oct 2005
    Location
    666th portal
    Search Comp PM
    sorry but that sort of thing you need to hire a programmer for.

    only i frames are complete. p, b and others are just the changes from the referenced frame. the first byte of the frame ends in a code signifying what type it is.
    --
    "a lot of people are better dead" - prisoner KSC2-303
    Quote Quote  
  5. Originally Posted by abeer View Post
    i need codes that can read a video stream and extract frames out of the stream, I,P,B frames , and i want it under windows,
    please any body can help me

    Exactly what are you asking for?

    What format do you want the exported "frames" in ? An image sequence (png, tiff, jpeg) ? Uncompressed YUV? or something else ?

    Be more specific
    Quote Quote  
  6. Member
    Join Date
    Jan 2012
    Location
    jordan
    Search Comp PM
    look i want to extract the I,P and B frames from the video(bit form) and i want to know how to discreminate between them , is there any bits or flags that i can use to discriminate the different types, i found a line code in ffmpeg that extract the I frames but as images(.jpg).
    i want to use this information that are in the application layer to discriminate between frames while applying discarding policied in the device that works in the network layer. i know it is not feasable but i have to find a way to discriminate betwwen the video frame in the network layer. i need a code or something that finds the frame types and how can we modify the codecs to add flags to recognise the frames???????????? please help me
    Quote Quote  
  7. ffdshow can output a .csv text file summary of current frame number and frame type (I,B,P) using it's OSD (along with other information if desired)

    You can have a look at the code , since it's free and open source, and modify it for your application
    Quote Quote  
  8. You can also look at framecounter by selur (see post #3). I don't know if sources are available , you can PM him
    http://forum.doom9.org/showthread.php?t=163553
    Quote Quote  
  9. Member
    Join Date
    Jan 2012
    Location
    jordan
    Search Comp PM
    thank u very much, but look i am beginner in video encoding, i want an ffmpeg line that could give me the types beside extracting them, i will then use these info as an input to my project using Matlab, i dont know if Matlab can support ffmpeg line codes, but i will try to find that.
    i downloaded FFdshow and i get two video encoder configuration and i saw the OSD that u mentioned, then how can apply this program on some video file?
    Quote Quote  
  10. Originally Posted by abeer View Post
    i want to extract the I,P and B frames from the video(bit form)
    What do you mean by "bit form"? Do you mean the compressed data stream? A BMP image? Something else?
    Quote Quote  
  11. Member
    Join Date
    Jan 2012
    Location
    jordan
    Search Comp PM
    my project is about proposing a new discarding policy when the buffer in the access point or the router overflow taking into consideration the video frame types, so
    1- i want to extract them first from the video and i want these frames(images) to be as an input to the matlab.(help me in this, i found a line code that extract I frames only, i want them all, with 30fps)
    2- as images if i use matlab to convert these images to numbers or matrices or something(i dont know what but i suppose matlab can read images), is there any numbers or flags that discriminate the diff types.
    sorry if i have problems in telling u what i want
    Quote Quote  
  12. VirtualDub and VirtualDub Mod can save the frames as BMP, JPG, PNG, or TGA images. They can also show the frame type on the status line (at the bottom of the window). You'll have to keep track of the frame types manually though. You could use VirtualDub(mod) to save the image sequence then use ffdshow to save a list of frame types.

    Do you realize you can't skip a P frame unless you skip all the way to the next I frame? And within the MPG file the frames will not be in display order.
    Last edited by jagabo; 15th Jan 2012 at 10:28.
    Quote Quote  
  13. Member
    Join Date
    Jan 2012
    Location
    jordan
    Search Comp PM
    thank u all, i will try them, but can u give me a simple ffmpeg instruction that extracts the frame type (all of them) because i only found the line that extracts the intra types, then i will try to disrimintate them
    Quote Quote  
  14. Member
    Join Date
    Jan 2012
    Location
    jordan
    Search Comp PM
    please any expert can answer me, i want commands so i will be able to include them to mattlab, not a full code or program like Member VirtualDub
    Quote Quote  
  15. Member
    Join Date
    Jan 2012
    Location
    jordan
    Search Comp PM
    is there any way that the output images in the folder will have I,P images, i dont need just information, i need the diff types as images
    Quote Quote  
  16. Member
    Join Date
    Jan 2012
    Location
    jordan
    Search Comp PM
    i saw the link, but i did not find what i want, how to get the diff frames and discriminate them when they r images?
    Quote Quote  
  17. You can't.

    Once they've been decoded, and encoded to images - they are no longer I, B, P . They are no longer video, and probably not in the same colorspace either (Y'CbCr vs. RGB). I, B, P refers to the frametype while it's still in video format, under a certain compression scheme . Even if you take the output directly from the decoder (uncompressed YCbCr) , then I, B, P no longer applies

    Take the list generated by selur's utility , or ffdshow osd to determine frametypes of what the original video was.
    Quote Quote  
  18. ffdshow's osd can either print the frame type within the frame or send the frame types to a text file with one line per frame.
    Quote Quote  
  19. Member
    Join Date
    Jan 2012
    Location
    jordan
    Search Comp PM
    i dont know how to use ffshow, can u help me. these frame types are input to my project , i need to extract the video types? i dont know what to do, this is a big problem
    Quote Quote  
  20. In ffdshow you need to enable the OSD (On Screen Display) filter:

    Start -> All Programs -> ffdshow -> Video Decoder Configuration

    In the left pane select and enable the OSD filter. In the right pane enable Frame Type. If you want a text file with a list of frame types enable the Save To option and specify where you want the file.

    While you're in this dialog I recommend you make sure ffdshow puts an icon in the System Tray when it's in use. In the left hand pane click on Tray, Dialog and Paths. In the right hand pane, in the Tray Icons section, make sure that Modern or Classic is selected. After doing this you will know when ffdshow is in use because an ffdshow icon will appear in the System Tray.

    Now you need to make sure your video player will use ffdshow as the MPEG 2 (or whatever codec you are working with) decoder. At the top of the left hand pane select Codecs. Make sure MPEG2 is enabled (set to libavcodec).

    After doing all that open your MPG file in a media player. Make sure that media player isn't using its own internal MPEG 2 decoder. Play the video. If ffdshow is in use you'll see the frame type at the top left corner of the windows. If you have file output enabled you'll see a text file that looks like:

    ;Frame type:
    ;I
    ;B
    ;B
    ;P
    ;B
    ;B
    ;P
    ;B
    etc.
    Quote Quote  
  21. Member
    Join Date
    Jan 2012
    Location
    jordan
    Search Comp PM
    how to make sure that media player isn't using its own internal MPEG 2 decoder
    Quote Quote  
  22. Originally Posted by abeer View Post
    how to make sure that media player isn't using its own internal MPEG 2 decoder
    It depends on which player you are using.

    You may also have to raise the priority of ffdshow or uninstall any other MPEG 2 decoders you have installed. Try Filmerit, RadLight FilterManager, DirectShow Filter Manager...
    Quote Quote  
  23. Member
    Join Date
    Jan 2012
    Location
    jordan
    Search Comp PM
    sorry, i tried , idid what u said, but nothing appear neither the .csv file
    Quote Quote  
  24. Then your player isn't using ffdshow.
    Quote Quote  
  25. Member
    Join Date
    Jan 2012
    Location
    jordan
    Search Comp PM
    sir, does this command help?
    ffmpeg -i video.mpg -b_qfactor 1/3 -i_qfactor 2 -b_qoffset 3 -i_qoffset 2 image%02.jpg
    Quote Quote  
  26. Member
    Join Date
    Jan 2012
    Location
    jordan
    Search Comp PM
    please sir, i need ur help, please be patient with me, i have to get the frame, how, i dont know, because these frames are input to matlab code depend on them, please help me in ffdshow, maybe i can get use of the text file generating, but i prefer a command
    Quote Quote  
  27. The following command will produce a number sequence of JPG images and a text file, list.txt, that shows information about each frame:

    Code:
     ffmpeg -i src.m2v -vf showinfo -f image2 img%05d.jpg  2>list.txt
    src.m2v is the source video file (an MPEG 2 elementary stream in this case). The JPG images will have the form:

    img00001.jpg
    img00002.jpg
    img00003.jpg
    etc.

    list.txt will have the information about the frames, including the frame type:

    Code:
    ffmpeg version N-33698-g6bca574, Copyright (c) 2000-2011 the FFmpeg developers
      built on Oct 16 2011 13:33:14 with gcc 4.6.1
      configuration: --enable-gpl --enable-version3 --enable-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
      libavutil    51. 21. 0 / 51. 21. 0
      libavcodec   53. 20. 1 / 53. 20. 1
      libavformat  53. 16. 0 / 53. 16. 0
      libavdevice  53.  4. 0 / 53.  4. 0
      libavfilter   2. 43. 6 /  2. 43. 6
      libswscale    2.  1. 0 /  2.  1. 0
      libpostproc  51.  2. 0 / 51.  2. 0
    [mpegvideo @ 01F88400] Estimating duration from bitrate, this may be inaccurate
    Input #0, mpegvideo, from 'src.m2v':
      Duration: 00:00:02.49, bitrate: 8000 kb/s
        Stream #0:0: Video: mpeg2video (Main), yuv420p, 720x576 [SAR 16:15 DAR 4:3], 8000 kb/s, 25 fps, 25 tbr, 1200k tbn, 50 tbc
    Incompatible pixel format 'yuv420p' for codec 'mjpeg', auto-selecting format 'yuvj420p'
    [buffer @ 01F8FF80] w:720 h:576 pixfmt:yuv420p tb:1/1000000 sar:16/15 sws_param:
    [showinfo @ 01B4DF00] auto-inserting filter 'auto-inserted scale 0' between the filter 'src' and the filter 'Parsed_showinfo_0'
    [scale @ 01B4DE60] w:720 h:576 fmt:yuv420p -> w:720 h:576 fmt:yuvj420p flags:0x4
    Output #0, image2, to 'img%05d.jpg':
      Metadata:
        encoder         : Lavf53.16.0
        Stream #0:0: Video: mjpeg, yuvj420p, 720x576 [SAR 16:15 DAR 4:3], q=2-31, 200 kb/s, 90k tbn, 25 tbc
    Stream mapping:
      Stream #0.0 -> #0.0 (mpeg2video -> mjpeg)
    Press [q] to stop, [?] for help
    [mpeg2video @ 01F88C60] warning: first frame is no keyframe
    [showinfo @ 01B4DF00] n:0 pts:40000 pts_time:0.040000 pos:66560 fmt:yuvj420p sar:16/15 s:720x576 i:B iskey:0 type:B checksum:1101685353 plane_checksum:[1049478894 2607004329 3431784628 0]
    [mpeg2video @ 01F88C60] warning: first frame is no keyframe
    [showinfo @ 01B4DF00] n:1 pts:80000 pts_time:0.080000 pos:94208 fmt:yuvj420p sar:16/15 s:720x576 i:B iskey:0 type:B checksum:3319530612 plane_checksum:[4032006158 919803314 2062640805 0]
    [showinfo @ 01B4DF00] n:2 pts:120000 pts_time:0.120000 pos:0 fmt:yuvj420p sar:16/15 s:720x576 i:B iskey:1 type:I checksum:1579548086 plane_checksum:[1976757627 1710351740 3618187952 0]
    [showinfo @ 01B4DF00] n:3 pts:160000 pts_time:0.160000 pos:143360 fmt:yuvj420p sar:16/15 s:720x576 i:B iskey:0 type:B checksum:1050519086 plane_checksum:[3030810004 2417069096 565025891 0]
    Quote Quote  
  28. ffmpeg can also pipe raw data into other programs , you might want to have a look at that. I don't know if matlab can accept it, but some other programs can . So you might pipe raw YUV instead of jpeg/png image sequences

    http://ffmpeg.org/ffmpeg.html#pipe
    Quote Quote  



Similar Threads

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