Hi,
First of all, thanks to Samuel Audet for creating and maintaining a killer set of libraries for us to play with :)
And my question: I'm running some code that takes a long time to complete, and it would be really useful to be able to view the MP4 file created by FFmpegFrameRecorder before the application calls stops on the recorder, to make sure everything is working ok (I'm running a few hundred processes in parallel on a cluster to process a large dataset, and don't want to wait a few days to find that it didn't work).
So I guess my question is, can FFmpegFrameRecorder be set up so that the file on disk can be read by a video player before rec.stop()is called?
I think this is similar to the
faststart progressive encoding switch mentioned in posts
here and
here and the
ffmpeg wiki, which I've added, but it doesn't seem to work.
My files seem to have the MP4 header (a block with moov, mvhd, trak strings etc) at the end regardless of whether I ass the faststart switches as in my the code below.
final FFmpegFrameRecorder rec = new FFmpegFrameRecorder(file, width, height);
rec.setVideoCodec(avcodec.AV_CODEC_ID_H264);
rec.setFormat("mp4");
rec.setPixelFormat(avutil.AV_PIX_FMT_YUV420P);
rec.setVideoQuality(20); //0=lossless, 23=pretty good
rec.setGopSize(10); //key-frame interval
rec.setFrameRate(frameRate);
rec.setVideoOption("faststart", "1"); //put header at start of file so incomplete movies will still play. Not sure if this works.
rec.setVideoOption("movflags", "+faststart");
rec.setVideoOption("movflags", "faststart");
rec.start();
//encode frames...
rec.stop()
rec.release()
Has anyone been able to get progressive encoding to work, and would this let me play my incomplete MP4 files?
Cheers,
Sam.