av-integrity workflow

Questions and answers on how to get the most out of FFAStrans
Post Reply
taner
Posts: 204
Joined: Sun Jun 19, 2016 6:36 pm

av-integrity workflow

Post by taner »

Hello Steinar,

I would like to create a workflow to check integrity of av-files using this ffmpeg-command in command-executor:
%comspec% /c ""T:\Transcoding\ffastrans\Applikation\Processors\ffmpeg\x64\ffmpeg.exe" -v error -i "%s_source%" -f null - >"%s_job_work%\%s_original_name%-%s_job_id%.txt" 2>&1"

It works and I get the expected file at the expected location with the expected name.

As far as I can see I always get a txt-file regardless whether outcome is successful (original av-file is damaged) or not.
When not successful (original av-file is ok) the txt-file is empty.

My goal is actually pretty simple.
If txt-file has any entry then report it (Generate text file).
If txt-file has no entry (blank) then do not report it.

Reporting is not the problem.
I've tried around with functions and populating and conditional etc. but I can't figure out how to check if txt-file has any entry or is blank.
I don't want to rely on the text itself if the outcome is successful because as far as I have seen it can differ from each other.
Checking filesize of txt-file was not possible too (successful txt-file has 1kb, unsuccessful txt-file has 0kb) because the available variable %i_original_size% checks the filesize of the original submitted file.
Maybe I can redirect this variable to txt-file?

I would appreciate if you could help me!

Taner
emcodem
Posts: 1631
Joined: Wed Sep 19, 2018 8:11 am

Re: av-integrity workflow

Post by emcodem »

Typically i try to make the executed command return a return code in order to provide the result directly to the workflow engine.
E.g. using the findstr command. You say in case there is no error, the ffmpeg output is empty. But in case it is not empty, does it always contain at least any number? If yes you could go with this:

comspec% /c ""T:\Transcoding\ffastrans\Applikation\Processors\ffmpeg\x64\ffmpeg.exe" -v error -i "%s_source%" -f null - | findstr /i "1 2 3 4 5 6 7 8 9 0"

This would end up in a negative return code in case there was no number in the output of the program.
emcodem, wrapping since 2009 you got the rhyme?
taner
Posts: 204
Joined: Sun Jun 19, 2016 6:36 pm

Re: av-integrity workflow

Post by taner »

Thanks for the hint emcodem!
I will have a look at it
admin
Site Admin
Posts: 1658
Joined: Sat Feb 08, 2014 10:39 pm

Re: av-integrity workflow

Post by admin »

Hi taner,

You can use the function $read("\\path\to\file.txt") and check if it equals nothing (an empty) string or not.

-steinar
Post Reply