VideoHelp Forum


Try DVDFab Video Downloader and rip Netflix video! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Page 1 of 2
1 2 LastLast
Results 1 to 30 of 34
Thread
  1. Hi

    my encode string is:

    FFMPEG.exe -i input.mxf -vcodec copy -an output.avi

    but now I would like to do the same but excluding from output.avi the first 10 frames: is it possibile in ffmpeg?

    thanks!
    Quote Quote  
  2. Not with your PAL XDCAM using -vcodec copy , because ffmpeg can only cut on GOP boundaries (12 frames for PAL XDCAM) . (Its not frame accurate for long GOP formats). But you can cut anywhere with I-frame formats using -vcodec copy

    Otherwise you can use -ss before the output name for seek position start time, -t for duration (length of clip cut) . If you omit -t, then it's cut from that -ss start point
    Quote Quote  
  3. thanks poison, only I have tryed to cut the firsts frame because when I import the output.avi via the VFW channel of nle Speed Razor, the scrub clip/playback is corrpted of the first 2/3 frames of the clip. Also seeking is not good but exporting is ok... ok except the first frame of each clip.

    I don't have well understand: my format (.mxf/mpg2) should don't have long gop/gop

    If I don't mistake mpeg-2 I frame don't have gop, so my output.avi have long gop?

    However Speed Razor have a module (mediapostgeneric.rzf) that can import everything via directshow but there is a problem: for each clip imported/touched/scrubbed it increase the use of amount ram so.. when I import/touch/scrub over 20-25 video clip it full the ram of my pc and the nle freeze/crash. Speed Razor5.51/Blade2.2 can import directly also .mxf file (via directshow, trough the mediapostgeneric.rzf module) but only few clip otherwise it ... freeze, when the total usage of ram is over 1,4 GB.


    I have add 2 GB on my system but it freeze identically when usage of ram exceeded 1,4 Gb by speedrazor.exe or blade.exe


    I've try an experiment: I have remove mediapostgeneric.rzf from the install directory, the nle remains without the capabilities of import external video files from the directshow channel but can import files - I think - from the VFW channel and magically usage of ram is low (maybe speed razor/blade load video clip on ram): in fact I can import mjpeg file that have the vtag "mjpg" or other type if the system have a suitable codec.


    For example: if I set in [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Drivers32]


    "VIDC.MJPG"="DigiVCap.dll"


    this means that speedrazor/blade nle try to import with the "matrox digisuite mjpeg vfw codec" all mjpeg files that have as vtag "mjpg" (not MJPG... because in this case speed razor use the internal mjpeg decoder)


    "VIDC.MJPG"="pvmjpg40.dll"


    this means that speedrazor/blade nle try to import with the "PIC mjpeg decoder" all mjpeg files that have as vtag "mjpg"


    If I set:


    "VIDC.MJPG"="ff_vfw.dll"



    or

    "VIDC.MPG2"="ff_vfw.dll"



    it means that for all the file imported in SR/Blade that have .mjpg or .mpg2 tag it try to decode them with the ffdshow vfw decoder



    Of course all the vfw codec should be installed and configured properly.


    Now I import my native clip (output.avi) with the association vidc.mpg2=ff_vfw.dll but the problem is the first and second frame are corrupted.


    Blade/Speed Razor can export it but the first frames are wrong: I attach exported file (exported.avi).


    I have try to change all parameter in the ffdshow VFW interface but the problem of the first frames remain.


    If I put the file mediapostgeneric.rzf in the working dir of speed razor/blade it import correctly the clip: scrub are good but exporting have the problem of wrong initial frames.


    I think the problem is not my nle: if I import output.avi in Virtualdub , also the exporting of virtualdub have the first 2 frames wrong (exportedVirtualdub.avi)


    So I think the problem is ffdshow.


    My original source: https://dl.dropboxusercontent.com/u/39871584/C0020.mxf


    output.avi = ffmpeg -i c0020.mxf -vcodec copy -an output


    Poison do you know any other alternative decoder mpg2 vfw that are not ffdshow?
    Image Attached Files
    Last edited by marcorocchini; 23rd Oct 2013 at 13:08.
    Quote Quote  
  4. here the export from virtualdub
    Image Attached Files
    Quote Quote  
  5. Originally Posted by marcorocchini View Post

    I don't have well understand: my format (.mxf/mpg2) should don't have long gop/gop
    XDCAMHD422 is Long GOP . The PAL version is 12 frame GOP

    If you stream copy, it's still the same video, just different container. Still 12 frame length GOP

    I frame (intra) encoded means the GOP length is 1. Every frame is an I frame



    However Speed Razor have a module (mediapostgeneric.rzf) that can import everything via directshow but there is a problem: for each clip imported/touched/scrubbed it increase the use of amount ram so.. when I import/touch/scrub over 20-25 video clip it full the ram of my pc and the nle freeze/crash. Speed Razor5.51/Blade2.2 can import directly also .mxf file (via directshow, trough the mediapostgeneric.rzf module) but only few clip otherwise it ... freeze, when the total usage of ram is over 1,4 GB.
    Doesn't matter, I would NEVER use directshow for editing - it's not frame accurate . You can seek to a place but if you seek back, or scrub elsewehere the frames and times can be mixed up







    Poison do you know any other alternative decoder mpg2 vfw that are not ffdshow?
    I would NEVER use VFW to edit Long GOP formats - not frame accurate, misssing/ green or black frames, frames out of order


    I know you want to get it working with your dinosaur editing software, but it's going to cause way more problems.

    Seriously, upgrade to something more modern
    Quote Quote  
  6. poison I understand but for all I have to do if I have work a minimum with speed razor is enought.

    Is possible the problem of wrong initial 2-3 frames is from the "quantization matrix" of the ffvfw module?

    Can I extract a quantization matrix from my output.avi and set ffvfw so it match the output.avi to play correctly?
    Quote Quote  
  7. No, it's not possible

    The problem is b-frames in AVI. If you remux to non AVI container - problem disappears - even with FFDSHOW

    In long GOP formats, encoded order can be different than display order and they can reference other future/past frames . But AVI specification is 1 frame in / out. Because of this frame re-ordering and AVI 1 frame in/out , you have problems with frames being out of order. - Often they can be displayed as black or green frames as well . That' s also why I-frame formats are safe in AVI container (each frame only references itself)

    The only way you can get this to work with AVI in speed razor without the seek issues or other problems is to re-encode to an I-frame format e.g. cineform, mjpeg, mpeg I-frame
    Quote Quote  
  8. in mjpeg all is working very well.

    I have try the "matrox mpeg2 I frame HD" codec: it work well via the vfw: occour install the codec pack and set "vidc.mpg2=mvcVfwMpeg2.dll". With virtualdub is necessary re-encode ... but it work perfectly in .avi container .. but I have to re encode.

    If I want reencode using ffmpeg can I keep exactly the same quality? and can I keep the .avi container?

    I'm forced to use .avi container because if I import e.g. mpeg files is necessary I able the mediapostgeneric.rzf module and I return to have the problem of the ram saturated.

    In avi mjpeg nothing problem, in .avi mpeg2 I have to use a VFW decoder and set it as the matrox mpeg2.

    Or is there a way to re encode lightly with ffmpeg and use ok ffdshow?

    ffmpeg -y -i c0020.mxf -vcodec mpeg2video ...? -pix_fmt yuvj444p -q:v 0 -minrate ? -maxrate ? -? -an output.avi

    why I prefer ffmpeg?

    1) for the high quality
    2) it can keep timecode information in .avi

    :=)
    Quote Quote  
  9. Originally Posted by marcorocchini View Post


    If I want reencode using ffmpeg can I keep exactly the same quality? and can I keep the .avi container?

    Only if you use a lossless codec (usually not edit friendly, slow to decode)



    I'm forced to use .avi container because if I import e.g. mpeg files is necessary I able the mediapostgeneric.rzf module and I return to have the problem of the ram saturated.

    In avi mjpeg nothing problem, in .avi mpeg2 I have to use a VFW decoder and set it as the matrox mpeg2.

    Or is there a way to re encode lightly with ffmpeg and use ok ffdshow?

    ffmpeg -y -i c0020.mxf -vcodec mpeg2video ...? -pix_fmt yuvj444p -q:v 0 -minrate ? -maxrate ? -? -an output.avi

    why I prefer ffmpeg?

    1) for the high quality
    2) it can keep timecode information in .avi

    :=)
    -intra , or -g 0 for I-frame

    you don't want to use yuvj444p for xdcamhd422 , you're uncessarily upscaling the chroma, and making it full range (the "j" in yuvj is full range flag). MPEG2 should be normal range. MJPEG normally uses full range
    Quote Quote  
  10. thank you, and for the bitrate?

    I would prefer to keep a costant bitare but I don't ever understand if my original stram have or not a costant birate, think yes however if I remux I have to set minrare/maxrate/bufsize? don't have idea about bufsize

    lossless codec .. nonono I have maximum 4TB, not 1000 TB of disk
    Quote Quote  
  11. Original XDCAM stream is CBR

    If want CBR encode , you have to set bitrate = maxrate and set the bufsize (you cannot use quantizer based encoding)

    Or *BEST* option is to get a modern NLE and edit natively
    Quote Quote  
  12. Originally Posted by marcorocchini View Post
    ffmpeg -y -i c0020.mxf -vcodec mpeg2video ...? -pix_fmt yuvj444p -q:v 0 -minrate ? -maxrate ? -? -an output.avi
    Use "-g 0" go get all i frames. You can then have frame accurate editing in VirtualDub without reencoding. Forget minrate and maxrate. Let the encoder use whatever bitrate it needs.
    Quote Quote  
  13. if I pay: can anyone develope a mpeg2 driver for In Sync Speed Razor ?!?

    Unfortunatly the In Sync company closed in 2003 ..
    Quote Quote  
  14. What's so special about this program ?

    I know some people get excited about antiques (cars, furniture) , maybe old paintings, old architecture /buildings .... but antique software !??!
    Quote Quote  
  15. it's simply the best nle.

    I think a good programmer don't have big problem to envelope a mpeg2 driver for it.

    Hoewver: D:\>ffmpeg -i c0020.mxf -vcodec mpeg2video -pix_fmt yuv422p -g 0 -q:v 0 -an cocco.avi

    Confronting quality = exactly the same (filesize 3x greather than original .mxf)

    using cocco.avi via the VFW "channel" (=delete mediapostgeneric.rzf from the install dir) scrubbing clip is total ok (no deblocking, all frame accurate scrub) but initial 2/3 frames are corrupted

    strange, strange

    I think the same happens in virtualdub
    Quote Quote  
  16. Originally Posted by marcorocchini View Post
    it's simply the best nle.
    In what way ?



    I think a good programmer don't have big problem to envelope a mpeg2 driver for it.
    I think it would be less expensive to buy a new NLE


    Hoewver: D:\>ffmpeg -i c0020.mxf -vcodec mpeg2video -pix_fmt yuv422p -g 0 -q:v 0 -an cocco.avi

    Confronting quality = exactly the same (filesize 3x greather than original .mxf)
    Close, but not "exactly". (It's not lossless)

    Also, if it's interlaced MPEG2 encoding, you also have to specify:

    -flags +ilme+ildct -alternate_scan 1 -top 1


    using cocco.avi via the VFW "channel" (=delete mediapostgeneric.rzf from the install dir) scrubbing clip is total ok (no deblocking, all frame accurate scrub) but initial 2/3 frames are corrupted
    Then likely it wasn't decoded properly . I'll take a closer look if I have time tonight
    Quote Quote  
  17. Originally Posted by marcorocchini View Post
    initial 2/3 frames are corrupted

    strange, strange
    Not strange at all. Your file was cut from an open GOP source and starts with a few b frames from the previous GOP. There's no way to reconstruct them so they end up with garbage.

    http://info.vela.com/Digital-Video-Applications-blog/bid/97903/Encoding-and-Decoding-P...GOP-Structures
    Quote Quote  
  18. Are we looking at the same video ? I'm not seeing any corrupt frames

    "C0020.mxf"
    Quote Quote  
  19. 1st GOP is technically closed . There are leading b's in display order, but they do not seem to reference outside of their own GOP . But 2nd GOP is open. If you cut at the end of the 1st GOP, right before the 2nd GOP , then the leading b's will be corrupted in that 2nd GOP . I don't see corrupt frames in the 1st GOP

    (the file I'm referring to is in post #3 his "original source" "C0020.mxf" )
    Quote Quote  
  20. Originally Posted by poisondeathray View Post
    Are we looking at the same video ? I'm not seeing any corrupt frames

    "C0020.mxf"
    Yes, the same video. I remuxed the video into an MPG container then used GSpot's GOP structure viewer:

    Presentation order:
    Click image for larger version

Name:	presentation.png
Views:	1359
Size:	11.4 KB
ID:	20773
    You can see that the video starts with 2 b frames (green boxes).

    Stored order:
    Click image for larger version

Name:	stored.png
Views:	1145
Size:	11.5 KB
ID:	20774
    Here you can see that those two b frames are stored after the first i frame. That's because the I frame has to be decoded (along with the last p frame of the previous GOP) before the two b frames can be decoded.

    Some decoders will skip those two leading b frames, some will return garbage or some other unpredictable frame.
    Quote Quote  
  21. Yes, I agree there are leading b's (as in post #19) , but are you seeing corrupted frames ? I'm not seeing corrupt frames with any software, nor if I re-encode it with ffmpeg .

    But if I cut off the 1st GOP as described above, then yes, there are corrupt frames in the 2nd GOP

    Some decoders will skip those two leading b frames, some will return garbage or some other unpredictable frame.
    The usual behavior in libavcodec based decoders are frame repeats. But I'm seeing unique, undamaged frames (and fields)
    Quote Quote  
  22. Originally Posted by poisondeathray View Post
    Yes, I agree there are leading b's (as in post #19) , but are you seeing corrupted frames ?
    It depends on the decoder and the container. When remuxed into an AVI container, when the video is first opened in VirtualDub (ffdshow decoding) I see two green frames at the start. If I continue forward and then scroll back to the beginning I get some random frames (usually the last two frames it decoded) instead of those green frames.

    In addition, ffdshow doesn't always decode the rest of the video properly when random seeking. There are often blocky errors.
    Quote Quote  
  23. But that's the AVI container issue. Have a look at the elementary stream. No errors, no seek errors
    Quote Quote  
  24. I agree the MPEG data isn't corrupt. Problems are caused by the reader/splitter/decoder.
    Quote Quote  
  25. I confirmed that the 1st GOP is closed with a stream analyzer, there are no references outside of it's own GOP .

    There is also a free old software program called "MPEGValidator" that lists if it's open or closed . I wasn't sure if it was accurate or not , so I tested on some other streams cutting GOP's and re-running . It's a buggy program but seems to be ok in that respect .

    But in his commandline with ffmpeg shouldn't have produced any corrupt frames using I-frame encodes (ffmpeg decodes and encodes it fine, since the 1st GOP is closed - it gives you a warning message, but the output frames are ok) - so I'm wondering what went wrong there . I can't reproduce his initial 2/3 corrupt frames . Unless it's a speed razor issue

    marcorocchini - What ffmpeg binary are you using ? Are the frames corrupt when viewed in other software ?
    Last edited by poisondeathray; 24th Oct 2013 at 10:25.
    Quote Quote  
  26. I believe all is ok but not

    also using ffmpeg -i c0020.mxf -vcodec mpeg2video -pix_fmt yuv422p -g 0 -q:v 0 -an cocco.avi

    scrub is not frame accurate, first frame/frames black and bad (not corruptes) .. editing bad.

    When I restore "mediapostgeneric.rzf" Speed Razor/Blade can use directshow to manage .avi files and all works ok.
    Even .mxf file can directly import ed edit, export ok but for each clip imported/touched/scrubbed auto-increase the total amount of ram usage and it wont reduce so at a certain point the system crash/frezze.

    When I remove mediapostgeneric.rzf Speed Razor/Blade can use only the vfw channel (using vidc.mpg2=ff_vfw.dll), and the "blade reader module" cannot act.

    Remaining the problem of non-accurate frame remains the problem caused by the decoder: black and/or bad first frame/frames remains also in virtualdub when virtualdub use VFW ffdshow.

    In old version of ffmpeg usually during encoding I get the error: first frame is not keyframes: I don't know exactly what it means.

    I use ffmpeg version N-57245-gf6b56b1. Other sw at the moment I can not test at this moment: seem playback ok with vlc and others but they using the direcshow "channel", not the VFW. Problem is present only when decode are do by the VFW module of FFdshow.

    I use FFdshow rev. 4519 but with all old version the problem remain.

    Virtualdub show the black first frame: and (al least in my pc) it don't use the (red) FFv but the VFW of ffdshow: is I disable the "MpegInAvi" codec in FFd/VFW virtualdub cannot open nothing so this means my is configured to use FFd/VFW to read "mpeg in avi" files. I think when you try open, vith virtualdub, a file associated to FFdshow and you can see the FFd red icon = use "FFdshow video decoder", otherwise it use (if open) it use VFW.

    For experiment: installing "matrox VFW mpeg 2 I frame HD" I can import and edit perfect the clip generated with this mpeg2codec but they have the good quality of FFmpeg. Matrox mpeg2 use only the VFW way: vidc.M701=mvcVfwMpeg2HD.dll

    Teorically I can use matrox mpeg 2... but if I have to turn the world go trough a re-encoding pass I keep the dear old damn mjpeg

    Only it was funny the idea of being able to edit the native clip (-vcodec copy)

    Hoewver I think the problem is in FFdshow or in encoding process or I don' know
    Image Attached Thumbnails Click image for larger version

Name:	FFD.JPG
Views:	442
Size:	259.2 KB
ID:	20783  

    Click image for larger version

Name:	BLADEVFW.JPG
Views:	445
Size:	306.9 KB
ID:	20784  

    Quote Quote  
  27. I can confirm problem is MPEG2 VFW decoder of ffdshow.

    Other I-frame formats don't have the problem e.g. ffv1 , uncompressed, ut video - so that rules out a decoding issue with ffmpeg before encoding . I don't know why ffdshow vfw mpeg2 decoder has this issue with I-frame formats, it shouldn't

    (It doesn't make a difference here in terms of scrubbing - but you should be encoding interlaced as mentioned above)
    Quote Quote  
  28. Maybe you can try this MPEG2 VFW codec . No idea if it's any good . It might be SD only
    http://www.etymonix.com/products/VideoCodec/VideoCodec.htm

    This one says it supports HD
    http://www.etymonix.com/products/softreel/softreel_mpeg2_decoder.htm
    Quote Quote  
  29. ffmpeg -i c0020.mxf -vcodec mpeg2video -pix_fmt yuv422p -g 0 -q:v 0 -an -flags +ilme+ildct -alternate_scan 1 -top 1 cocco2.avi

    but result is the same.

    Can ffmpeg encode in ffv1? or I do have to contact the developer of ffdshow?
    Quote Quote  
  30. Result is the same in terms of scrubbing / frame issues - that's what I said earlier. But the encoding is properly encoded and flagged interlaced . Notice filesize is different . This also makes a difference to some programs which might interpret the chroma as progressive when upsampling (e.g when using RGB filters) - you get chroma upsampling error (notching along color edges) .

    Yes ffmpeg can encode ffv1, but it's a very very slow lossless codec - slower and more compressed than lagarith (not good for editing, more for storage/archival purpose)

    Another one you might try is softlab-nsk foward mpeg2 I-frame . Looks similar to matrox I-frame MPEG2 . No idea how good it is . You might have to -vtag "slif" to route it through it's decoder
    http://www.softlab-nsk.com/forward/download.html#codecs

    http://roundup.libav.org/issue1469
    Quote Quote  



Similar Threads