Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 2nd August 2017, 19:25   #1  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,559
Detect Invalid Video File

I have written code that encodes videos in several segments and then merges at the end. It works fine *AS LONG AS* any segment is terminated cleanly. If you kill any of the FFMPEG processes, however, the merge will result in undefined behaviors.

How can I detect whether a video file is valid to prevent such undefined behavior? Is there any way to recover parts of an invalid file to make it valid, perhaps by discarding the end?

Thanks
MysteryX is offline   Reply With Quote
Old 2nd August 2017, 19:37   #2  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Recover Parts: Just do a remux in ffmpeg and it should chop off crap at the end.

Remux to MKV,

Code:
setlocal

REM Where to Find ffmpeg
set FFMPEG="C:\BIN\ffmpeg.exe"

REM Where to get input file, No terminating Backslash, "." = current directory
set INDIR="."


REM Where to place output file, No terminating Backslash.
set OUTDIR=".\OUTPUT"


FOR %%A IN (*.wmv *.mpg *.avi *.flv *.mov *.mp4 *.m4v *.RAM *.RM) DO (
  %FFMPEG% -i "%INDIR%\%%A" -vcodec copy    -acodec copy  "%OUTDIR%\%%~nxA.MKV"

)

Pause
It dont like SPACE's in names.

EDIT: Maybe RaffRiff can comment on ffProbe use for error detection (Usually comes with full ffmpeg package).
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 2nd August 2017 at 19:40.
StainlessS is offline   Reply With Quote
Old 2nd August 2017, 20:54   #3  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,559
Remux is a good idea, it should work.

I however only want to do it if it is necessary -- how to know that?
MysteryX is offline   Reply With Quote
Old 5th August 2017, 03:47   #4  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,559
In terms of terminating FFMPEG cleanly, I just found something. I run AVS2YUV and pipe it to FFMPEG; and now can run 4 instances in parallel. Killing FFMPEG gives an invalid file. Soft killing all 4 instances takes considerable time. If I hard kill the 4 instances of AVS2YUV, however, that stops immediately and FFMPEG still finishes writing its file

If someone kills a FFMPEG process manually, however, I still have no way of knowing the file is bad.
MysteryX is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:23.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.