• Identify content type (Video, Audio, Memo, Slides, etc.)
• Calculate duration or page count
• If audio/video, auto-transcribe the content
I need suitable node for above scenario?
If anyone has idea…
• Identify content type (Video, Audio, Memo, Slides, etc.)
• Calculate duration or page count
• If audio/video, auto-transcribe the content
I need suitable node for above scenario?
If anyone has idea…
You’re working on a great use case! Here’s how you can break it down in n8n using the right tools or APIs:
.pdf
, .mp3
, .mp4
, .docx
, etc.).pdf-parse
(if self-hosted) to get page count.ffprobe
is the best for duration, codec, etc.Let me know if you want a sample workflow (e.g. get video length + transcribe it). You’ll likely need a mix of:
Hope that helps you get started!
Thank you so much… Let me test out your suggestion,
one doubt : Here function node, you mean, code node right?
If I find any issue… May I ping you back?
You’re very welcome!
Yes — by Function node, I mean the Code node (which used to be called Function in older versions of n8n). It allows you to write custom JavaScript, perfect for checking file types or extracting metadata if you’re handling it manually.
And absolutely — feel free to ping me back if you run into any issues. Happy to help!
Sorry to bother you again,
but there is not ‘ffprobe’ node. (I might need to use Http request node) but if that’s the case I could use whisper API (for both) rather than making 2 API calls…
And if you could provide sample workflow, that would be awesome. Because I’m confused about passing that file as input to code
node.
Sure! Here’s a simple example workflow to help you extract metadata using a Code node, especially if you decide not to use ffprobe
.
Let’s say you upload a file (PDF, MP3, etc.), and want to:
pdfinfo
/libmagic
tools via API).The file will be in binary
format. In your Code Node, you can access it like this:
const file = $binary["your_file_field_name"];
const fileName = $json["your_file_field_name"]?.fileName || "unknown";
return [
{
json: {
fileName,
fileSize: file?.data?.length,
mimeType: file?.mimeType,
},
binary: {
data: file,
},
},
];
ffprobe
, exiftool
) and using Execute Command
node.Let me know which file type you’ll work with first — I can help tailor the flow for that.
Pardon, I’m a bit confused,
Below is my workflow’s JSON.
Can you edit that to use the file in the code node?
Perfect! Based on the workflow you’ve shared, here’s a quick response you can post to help Himanshu_Rana understand how to pass the file into the Code node directly:
Thanks for sharing your workflow! Based on your setup, here’s how you can access the uploaded file in the Code node:
Assuming the file is still available in binary form (uploaded via the Form trigger), here’s a sample to include in the Code node:
const binaryKey = Object.keys($binary)[0]; // Automatically picks the first uploaded file
const fileData = $binary[binaryKey];
const fileName = fileData?.fileName || "unknown";
const mimeType = fileData?.mimeType || "unknown";
return [
{
json: {
fileName,
mimeType,
fileSize: fileData?.data?.length,
},
binary: {
data: fileData
}
}
];
This will:
Merge
node or restructure the logic.console.log(Object.keys($binary))
to debug what binary fields are available.Let me know what kind of file you’re testing with (PDF, MP3, etc.) and I’ll help tailor the logic for that format.
No it’s not helping, I’m not able to pass that to the code