[FFmpeg-user] Hooking into MOOV atom move process
Eugene Gekhter
egekhter at pixcel.com
Fri Jun 27 20:42:59 CEST 2014
Try moving the output files as soon as the exec command is finished.
*Eugene Gekhter* / CEO
(847) 272-8207/ egekhter at pixcel.com
*Pixcel* Office: (800) 557-3508
3336 Commercial Ave. / Northbrook, IL 60062
http://www.pixcel.com
On Fri, Jun 27, 2014 at 1:39 PM, Molly Millions <
mollyrazormillions at gmail.com> wrote:
> I have just run your script and could not reproduce anything you've
> described. When exec returns all of the output files are done, there are no
> content changes. The problem might be an out of memory error. That's why
> exec returns prematurely. I presume you are running in a shared host
> environment. So check your php.ini (or check the phpinfo() output before
> running your script) also check your nginx and or apache config for php
> related memory limits or RLimitMem options. Also, check yout exitcode.
>
>
> On Fri, Jun 27, 2014 at 6:49 PM, Eugene Gekhter <egekhter at pixcel.com>
> wrote:
>
> > $cmd = 'sudo ffmpeg -i ' . $local_file . ' -y -vcodec libx264 -tune
> > zerolatency -movflags faststart -crf 23 -profile:v high -level:v 4.0
> > -maxrate 6000k -bufsize 12000k -acodec libfdk_aac -b:a 256k ' .
> > $output_directory. $data['temp_file_key'] . '_HQ.mp4 -vcodec libx264 -s
> ' .
> > $sq_width . 'x' . $sq_height . ' -tune zerolatency -movflags faststart
> -crf
> > 25 -profile:v main -level:v 3.1 -maxrate 1400k -bufsize 1400k -acodec
> > libfdk_aac -b:a 256k ' . $output_directory. $data['temp_file_key'] .
> > '_SQ.mp4 -ss ' . $seek_half . ' -f image2 -vframes 1 ' .
> $output_directory.
> > $data['temp_file_key'] . '_poster.jpg -ss ' . $seek_half . ' -f image2
> -vf
> > scale=-1:240 -vframes 1 ' . $output_directory. $data['temp_file_key'] .
> > '_thumb.jpg' . ' 1> ' . $log_directory . $data['temp_file_key'] .
> '_log.txt
> > 2>&1';
> >
> > exec($cmd, $out, $ret);
> >
> >
> > *Eugene Gekhter* / CEO
> >
> > (847) 272-8207/ egekhter at pixcel.com
> > *Pixcel* Office: (800) 557-3508
> > 3336 Commercial Ave. / Northbrook, IL 60062
> > http://www.pixcel.com
> >
> >
> >
> >
> >
> >
> > On Fri, Jun 27, 2014 at 11:43 AM, Molly Millions <
> > mollyrazormillions at gmail.com> wrote:
> >
> > > Of course it returns, since you must be running two separate ffmpeg
> > > commands (separated by a ;) after each other. Can you copy the command
> > you
> > > are executing from php?
> > >
> > >
> > > On Fri, Jun 27, 2014 at 4:47 PM, Eugene Gekhter <egekhter at pixcel.com>
> > > wrote:
> > >
> > > > I execute ffmpeg command from PHP script.
> > > > The execute command goes on for a long time, but for some reason, it
> > > > returns as soon as encoding is finished and then continues running
> rest
> > > of
> > > > my script. It returns after encoding the whole video, but before
> moving
> > > the
> > > > MOOV atom to beginning. I'm not familiar with the signals that go on
> in
> > > the
> > > > background to know exactly the reason.
> > > >
> > > >
> > > > *Eugene Gekhter* / CEO
> > > >
> > > > (847) 272-8207/ egekhter at pixcel.com
> > > > *Pixcel* Office: (800) 557-3508
> > > > 3336 Commercial Ave. / Northbrook, IL 60062
> > > > http://www.pixcel.com
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > On Fri, Jun 27, 2014 at 9:32 AM, Denys Khanzhyiev <xdenser at gmail.com
> >
> > > > wrote:
> > > >
> > > > > So you try to move file before ffmpeg finishes?
> > > > > I move files converted with this flag w/o problems after ffmpeg
> > exits.
> > > > >
> > > > >
> > > > > 2014-06-27 16:31 GMT+03:00 Eugene Gekhter <egekhter at pixcel.com>:
> > > > >
> > > > > > On Fri, Jun 27, 2014 at 8:23 AM, Denys Khanzhyiev <
> > xdenser at gmail.com
> > > >
> > > > > > wrote:
> > > > > >
> > > > > > > Why not just directly use option -movflags faststart?
> > > > > > >
> > > > > > >
> > > > > > > 2014-06-27 16:14 GMT+03:00 Eugene Gekhter <egekhter at pixcel.com
> >:
> > > > > > >
> > > > > > > > Hi,
> > > > > > > >
> > > > > > > > Does anybody know how to hook into this process from Linux
> > > command
> > > > > > line?
> > > > > > > >
> > > > > > > > Basically, to enable users to start streaming a video before
> > > > > > downloading
> > > > > > > > the whole file, after encoding a h.264 video file, the MOOV
> > atom
> > > > > needs
> > > > > > to
> > > > > > > > be moved from the end of the file to the beginning of the
> file.
> > > > Since
> > > > > > we
> > > > > > > > move the file to its final destination right after encoding
> is
> > > > > finished
> > > > > > > so
> > > > > > > > the user can start using it right away, the whole movie gets
> > > > > corrupted
> > > > > > if
> > > > > > > > the MOOV atom has not been properly moved. I initially put in
> > a 5
> > > > > > second
> > > > > > > > sleep then a 30 second sleep into the script, but that is
> not a
> > > > > blanket
> > > > > > > > solution so I need to figure out a way to hook into the end
> of
> > > the
> > > > > moov
> > > > > > > end
> > > > > > > > process.
> > > > > > > >
> > > > > > > > I hope somebody has a simple solution to this problem.
> > > > > > > >
> > > > > > > > Thank you,
> > > > > > > >
> > > > > > > > *Eugene Gekhter* / CEO
> > > > > > > >
> > > > > > > > (847) 272-8207/ egekhter at pixcel.com
> > > > > > > > *Pixcel* Office: (800) 557-3508
> > > > > > > > 3336 Commercial Ave. / Northbrook, IL 60062
> > > > > > > > http://www.pixcel.com
> > > > > > > > _______________________________________________
> > > > > > > > ffmpeg-user mailing list
> > > > > > > > ffmpeg-user at ffmpeg.org
> > > > > > > > http://ffmpeg.org/mailman/listinfo/ffmpeg-user
> > > > > > > >
> > > > > > > _______________________________________________
> > > > > > > ffmpeg-user mailing list
> > > > > > > ffmpeg-user at ffmpeg.org
> > > > > > > http://ffmpeg.org/mailman/listinfo/ffmpeg-user
> > > > > > >
> > > > > >
> > > > > > That is the case, I am using that flag to encode my video,
> however,
> > > as
> > > > it
> > > > > > says on the website, the move process can take *a while*.
> > > > > > There is this solution for Atomic Parsley or qtfaststart
> > > > > > <
> > > >
> http://superuser.com/questions/559372/using-ffmpeg-to-locate-moov-atom
> > >
> > > > > > which
> > > > > > could be used to check every x seconds if the there's a
> preg_match
> > > > (PHP)
> > > > > on
> > > > > > the output of that process, but I am looking for an ffmpeg-first
> > > > > solution.
> > > > > >
> > > > > > Thanks,
> > > > > >
> > > > > >
> > > > > > *Eugene Gekhter* / CEO
> > > > > >
> > > > > > (847) 272-8207/ egekhter at pixcel.com
> > > > > > *Pixcel* Office: (800) 557-3508
> > > > > > 3336 Commercial Ave. / Northbrook, IL 60062
> > > > > > http://www.pixcel.com
> > > > > > _______________________________________________
> > > > > > ffmpeg-user mailing list
> > > > > > ffmpeg-user at ffmpeg.org
> > > > > > http://ffmpeg.org/mailman/listinfo/ffmpeg-user
> > > > > >
> > > > > _______________________________________________
> > > > > ffmpeg-user mailing list
> > > > > ffmpeg-user at ffmpeg.org
> > > > > http://ffmpeg.org/mailman/listinfo/ffmpeg-user
> > > > >
> > > > _______________________________________________
> > > > ffmpeg-user mailing list
> > > > ffmpeg-user at ffmpeg.org
> > > > http://ffmpeg.org/mailman/listinfo/ffmpeg-user
> > > >
> > > _______________________________________________
> > > ffmpeg-user mailing list
> > > ffmpeg-user at ffmpeg.org
> > > http://ffmpeg.org/mailman/listinfo/ffmpeg-user
> > >
> > _______________________________________________
> > ffmpeg-user mailing list
> > ffmpeg-user at ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-user
> >
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
More information about the ffmpeg-user
mailing list