[SOLVED] Please help to find a way to open or convert AVI(X265) video from IP camera
2 posters
Page 1 of 1
[SOLVED] Please help to find a way to open or convert AVI(X265) video from IP camera
Hi, i'm having problems opening or converting the videos from my ip camera's SD card. Videos itself are playable through V380 Pro mobile app.
Audio plays.
Tried: LAV (from K-Lite Codec Pack), ffmpeg, x265vfw - those failed
Sample AVI file: https://drive.google.com/file/d/1ocVHhhvXuosijYf8xVJ2M3E8xXI6otY0/view?usp=share_link
Please advice.
Audio plays.
Tried: LAV (from K-Lite Codec Pack), ffmpeg, x265vfw - those failed
Sample AVI file: https://drive.google.com/file/d/1ocVHhhvXuosijYf8xVJ2M3E8xXI6otY0/view?usp=share_link
Please advice.
Last edited by farms on Mon Dec 19, 2022 9:03 am; edited 1 time in total
farms- Posts : 2
Join date : 2022-12-18
Re: [SOLVED] Please help to find a way to open or convert AVI(X265) video from IP camera
Open the file with a HexEditor.
In the beginning of the file, replace x265 with hvc1.
Then you should be able to play it.
To get proper support for such files in all apps, I suggest submitting it to FFmpeg bug tracker:
http://trac.ffmpeg.org/query?status=new&status=open&status=reopened&col=id&col=summary&col=status&col=type&col=component&col=version&col=time&col=changetime&report=1&desc=1&order=changetime
Mention that changing the FourCC makes it playable. They can add support for it.
In the beginning of the file, replace x265 with hvc1.
Then you should be able to play it.
To get proper support for such files in all apps, I suggest submitting it to FFmpeg bug tracker:
http://trac.ffmpeg.org/query?status=new&status=open&status=reopened&col=id&col=summary&col=status&col=type&col=component&col=version&col=time&col=changetime&report=1&desc=1&order=changetime
Mention that changing the FourCC makes it playable. They can add support for it.
Re: [SOLVED] Please help to find a way to open or convert AVI(X265) video from IP camera
Thank you, absolutely perfect answer. Now i'll be able to process all the files with some script
Upd. My script for node.js in case someone else will be looking for a solution
Upd. My script for node.js in case someone else will be looking for a solution
- Code:
const fs = require('fs').promises;
const root = 'g:/NAS/Camera/'
const dest = 'g:/NAS/CameraFixed/'
const stats = {
found: 0,
fixed: 0,
}
async function readFile(filePath) {
try {
return await fs.readFile(filePath);
} catch (error) {
//
}
}
async function writeFile(filePath, buffer)
{
try {
return await fs.writeFile(filePath, buffer);
} catch (error) {
//
}
}
async function makeDirTree(path)
{
await fs.mkdir(path, { recursive: true });
}
const getContents = async source => {
let files = [];
let folders = [];
(await fs.readdir(source, { withFileTypes: true }))
.map(dirent => {
if (dirent.isDirectory() && dirent.name.indexOf('.') != 0)
{
folders.push(dirent.name)
} else
if (dirent.name.endsWith('.avi'))
{
files.push(dirent.name)
}
})
return {files, folders}
}
const crawl = async (source) => {
let found = await getContents(source)
for (let file of found.files)
{
stats.found ++
console.log(source + file)
const strs = 'x265'
let binary = await readFile(source + file)
if (binary[196] == strs.charCodeAt(0) && binary[197] == strs.charCodeAt(1) && binary[198] == strs.charCodeAt(2) && binary[199] == strs.charCodeAt(3))
{
const str = 'hvc1'
binary[196] = str.charCodeAt(0)
binary[197] = str.charCodeAt(1)
binary[198] = str.charCodeAt(2)
binary[199] = str.charCodeAt(3)
let destination = dest + source.replace(root, '')
await makeDirTree(destination)
await writeFile(destination + file, binary)
stats.fixed ++
}
}
for (let folder of found.folders)
{
await crawl(source + folder + '/')
}
}
const work = async () => {
await crawl(root)
console.log(stats)
}
work()
farms- Posts : 2
Join date : 2022-12-18
Re: [SOLVED] Please help to find a way to open or convert AVI(X265) video from IP camera
Just a note for anyone else that might be tempted to use that script. The position of the FourCC is hardcoded. It might be at a different binary position in other file sets. So don't forget to verify the binary offset. Or adjust the script to search for the first occurrence in the first couple hundred bytes.
The header of this file seems to be a bit messed up in general. So that is why FourCC changing tools might fail. And tools like MediaInfo show incorrect height.
The header of this file seems to be a bit messed up in general. So that is why FourCC changing tools might fail. And tools like MediaInfo show incorrect height.
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum