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!
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 1 to 30 of 34
Thread
-
-
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 -
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?Last edited by marcorocchini; 23rd Oct 2013 at 12:08.
-
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.
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 -
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? -
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 -
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
:=) -
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
:=)
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 -
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 -
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 -
-
if I pay: can anyone develope a mpeg2 driver for In Sync Speed Razor ?!?
Unfortunatly the In Sync company closed in 2003 .. -
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 !??! -
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 -
In what way ?
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)
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
-
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 -
Are we looking at the same video ? I'm not seeing any corrupt frames
"C0020.mxf" -
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" ) -
Yes, the same video. I remuxed the video into an MPG container then used GSpot's GOP structure viewer:
Presentation order:
You can see that the video starts with 2 b frames (green boxes).
Stored order:
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. -
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. -
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. -
But that's the AVI container issue. Have a look at the elementary stream. No errors, no seek errors
-
I agree the MPEG data isn't corrupt. Problems are caused by the reader/splitter/decoder.
-
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 09:25.
-
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 -
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) -
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 -
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
Similar Threads
-
ffmpeg - Override/Set ISFT Metadata?
By Ruler2112 in forum Video ConversionReplies: 11Last Post: 27th Oct 2013, 03:01 -
How to set ReFrames in ffmpeg
By wycklk in forum Video ConversionReplies: 1Last Post: 26th Sep 2013, 09:31 -
FFMPEG: extract frames
By mogadanez in forum Video ConversionReplies: 6Last Post: 4th May 2012, 11:06 -
FFMPEG encode directory
By darklift in forum LinuxReplies: 6Last Post: 3rd Feb 2012, 23:50 -
Can Ripbot263 be set to encode in MPEG4
By jntaylor63 in forum Video ConversionReplies: 1Last Post: 18th Feb 2010, 10:24