video - converting files with FFMPEG ... NO MOOV ATOM at the end of the file -


i'm doing following:

  1. i use ffmpeg delphi xe2 program convert file receive mp4 file.
  2. i use qr-faststart move atom begin of file after converting.

the problem after conversion of files (not always) qr-faststart give following error:

  • "encountered non-qt top-level atom (is quicktime file?)"
  • "last atom in file vas not moov atom"

the command line ffmpeg : -i "sourcefile" -sameq "destinationfile"

the command line qt-faststart "sourcefile" "destfile"

here full code of both function:

function tfrmmain.convertfile(avideofile: string; var anewfile: string): boolean; var seinfo: tshellexecuteinfo;     exitcode: dword;     executefile, paramstring, startinstring: string;     tmpvideofile : string;     logcommand   : string; begin   logmain.writefeedbackmessage(format('enter convertfile %s ...', [avideofile]), '', eventlog_information_type, false);   result := false;   startinstring := edconverterpath.text;   tmpvideofile  := extractfilename(avideofile);   anewfile      := changefileext(tmpvideofile, '.mp4');   if tmpvideofile = anewfile begin     logmain.writefeedbackmessage('the file converted ...', '', eventlog_information_type, false);     if optimizefaststart(avideofile) begin       result := true;     end;     exit;   end;   anewfile := extractfilepath(avideofile) + anewfile;   if fileexists(anewfile) begin     deletefile(anewfile);   end;   logcommand := '';   if cklog.checked begin     logcommand := ' -loglevel verbose -report';   end;   paramstring := '-i "' + avideofile + '" -sameq "' + anewfile + '" ' + logcommand;   logmain.writefeedbackmessage(format('paramstring %s', [paramstring]), '', eventlog_information_type, false);   executefile := includetrailingbackslash(startinstring) + 'ffmpeg.exe';   if fileexists(executefile) begin     fillchar(seinfo, sizeof(seinfo), 0) ;     seinfo.cbsize := sizeof(tshellexecuteinfo) ;     seinfo begin       fmask := see_mask_nocloseprocess;       wnd := application.handle;       lpfile := pchar(executefile) ;       //paramstring can contain application parameters.       lpparameters := pchar(paramstring) ;       //  startinstring specifies  name of working directory. if ommited, current directory used.       lpdirectory := pchar(startinstring) ;       nshow := sw_shownormal;     end;     if shellexecuteex(@seinfo) begin       repeat         application.processmessages;         getexitcodeprocess(seinfo.hprocess, exitcode) ;       until (exitcode <> still_active) or application.terminated;     end;     if fileexists(anewfile) begin       logmain.writefeedbackmessage(format('converting video %s succesfull!', [avideofile]), format('file %s created.', [anewfile]), eventlog_information_type, true, false, false);       if optimizefaststart(anewfile) begin         result := true;       end;     end;   end else begin     logmain.writefeedbackmessage(format('file %s not exist on server!', [executefile]), 'the converter cannot located on disk!' + #13#10 + executefile, eventlog_error_type, true, false, false);   end; end; 

the fast start here

function tfrmmain.optimizefaststart(avideofile: string): boolean; var seinfo: tshellexecuteinfo;     exitcode: dword;     executefile, paramstring, startinstring: string;     strvideofile : string;     newvideofile : string;     startcommand : string; begin   // need fast start utility   logmain.writefeedbackmessage(format('enter optimizefaststart %s ...', [avideofile]), '', eventlog_information_type, false);   result := false;   startinstring := edconverterpath.text;   strvideofile  := extractfilename(avideofile);   newvideofile  := 'tmp_' + strvideofile;   if strvideofile = avideofile begin     strvideofile  := startinstring + strvideofile;     newvideofile  := startinstring + newvideofile;   end;   if not fileexists(strvideofile) begin     logmain.writefeedbackmessage(format('file %s dont exist...', [strvideofile]), '', eventlog_information_type, false);     exit;   end;   if fileexists(newvideofile) begin     deletefile(newvideofile);   end;    paramstring := format('"%s" "%s"', [strvideofile, newvideofile]);   executefile := includetrailingbackslash(startinstring) + 'qt-faststart.exe';   if fileexists(executefile) begin     logmain.writefeedbackmessage(format('source %s destination %s', [strvideofile, newvideofile]), '', eventlog_information_type, false);     fillchar(seinfo, sizeof(seinfo), 0) ;     seinfo.cbsize := sizeof(tshellexecuteinfo);     seinfo begin       fmask := see_mask_nocloseprocess;       wnd := application.handle;       lpfile := pchar(executefile) ;       lpparameters := pchar(paramstring);       lpdirectory  := pchar(startinstring);       nshow        := sw_shownormal;     end;     if shellexecuteex(@seinfo) begin       repeat         application.processmessages;         getexitcodeprocess(seinfo.hprocess, exitcode) ;       until (exitcode <> still_active) or application.terminated;     end;     logmain.writefeedbackmessage(format('after file executed...', [strvideofile]), '', eventlog_information_type, false);     sleep(500);     application.processmessages;     if fileexists(newvideofile) begin       deletefile(strvideofile);       application.processmessages;       sleep(500);       application.processmessages;       logmain.writefeedbackmessage(format('before rename file...', [strvideofile]), '', eventlog_information_type, false);       if renamefile(newvideofile, strvideofile) begin         logmain.writefeedbackmessage(format('rename file ok...', [strvideofile]), '', eventlog_information_type, false);         result := true;         logmain.writefeedbackmessage(format('processing video %s web succesfull!', [strvideofile]), '', eventlog_information_type, true);       end;     end else begin       logmain.writefeedbackmessage(format('file %s not exist!...', [newvideofile]), '', eventlog_information_type, true);     end;   end else begin     logmain.writefeedbackmessage('cannot find qt-faststart.exe converter on disk!', executefile, eventlog_error_type, true);   end; end; 

can advice me how fix problem.

remove -sameq option, not mean same quality. also, version of ffmpeg have? if not have latest, update. should fix problem. can post complete command line output?


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -