[FFmpeg-user] Hooking into MOOV atom move process

Denys Khanzhyiev xdenser at gmail.com
Sat Jun 28 08:10:20 CEST 2014


Try to run lsof greping for your file to see if your file is still open by
something before move.


2014-06-28 4:40 GMT+03:00 Eugene Gekhter <egekhter at pixcel.com>:

> As I illustrated with code, the file mv happens after exec($cmd). File Mv
> kicks in after the full movie is encoded, but before the moov atom has
> finished moving. It's an unexpected problem which was difficult to debug. I
> found a work around solution using AtomicParsley which has no cost so I'm
> content.
>
> Sent from my iPhone
>
> > On Jun 27, 2014, at 7:34 PM, Reindl Harald <h.reindl at thelounge.net>
> wrote:
> >
> >
> > Am 28.06.2014 02:21, schrieb Eugene Gekhter:
> >> Look into the source code - there's a message couldn't move atom to
> beginning.
> >> Can't open input.mp4 . I'm paraphrasing from memory.
> >
> > that don't change the fact that ffmpeg called with php-cli
> > don't return before it has finished and -movflags faststart
> > happens in the same cli-call as the convert
> >
> >> Basically if the file is moved before the atom move process is
> finished, the
> >> file becomes corrupt. The executing of process takes place from web app
> >
> > basically if the file is moved in the middle of the convert
> > it is corrupt - so what - why does your web-app move the
> > file before the cli has finished?
> >
> >>> On Jun 27, 2014, at 7:02 PM, Reindl Harald <h.reindl at thelounge.net>
> wrote:
> >>>
> >>> besides that use 'sudo' is complete nonsense from any
> >>> security point of view we are doing that for years now
> >>> and *no* it's not a ffmpeg problem - after ffmpeg returns
> >>> the encoded file is finished with no but and if
> >>>
> >>> Am 27.06.2014 20:42, schrieb Eugene Gekhter:
> >>>> Try moving the output files as soon as the exec command is finished.
> >>>>
> >>>> 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);
> >
> > _______________________________________________
> > 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