Closed SebaBoler closed 1 year ago
Hi @SebaBoler
Is createReadStream()
returning a valid read stream?
You don’t need any additional libs installed, the error comes from ffprobe not being able to parse the input stream so the libs are probably already there and available, double check the input stream because the issue is probably there
createReadStream is valid. Without any problem is uploaded to cloud . I have checked 5 times and this same file on the local server works perfectly with getVideoDuration.
Other media info apps read from stream all info that I need without any issue.
I tried other ways and replace stream with filename but every time I have the error -1 fullPath/filename No such file or directory In the mutation of Graphql, I used FileUpload and the file is exists but not in the directory /src
Its nice example on local env :
Logger.log(`${await getVideoDurationInSeconds(createReadStream())}`); return properly number
duration from promise return issue : No found duration
const { createReadStream } = await data.videoFile;
Logger.log(`${await getVideoDurationInSeconds(createReadStream())}`);
let duration: number;
await new Promise<void>((resolve, reject) => {
const stream = createReadStream();
// Listen for any errors that might occur when creating the stream
stream.on('error', (error) => {
reject(error);
});
// Pass the stream to getVideoDurationInSeconds
getVideoDurationInSeconds(stream).then((value) => {
duration = value;
resolve();
});
There are some codecs that don't work properly with the stream-based API, this is something that happen in matroska container but can happen in other containers, too (see this issue), for instance). This limitation happens because those formats don't include the duration information in the header, and the underlying ffprobe cannot extract the duration without parsing the entire stream
For those situations I suggest keeping a local copy of the stream and extracting its duration before uploading them into your cloud provider or alternatively downloading the file from the cloud provider, parsing it locally and then storing the duration
@Sumolari thanks. I have change strategy - media data we are extract on Frontend before upload
Hello,
i used
on local computer MacOs works but when I will use function on docker ( Digitial Ocean ) I always receive
I must install some lib etc in Docker ?