improve error message from ffprobe

fixes #1342
pull/1361/head
Mikael Finstad 4 years ago
parent 479569e378
commit 20fa1b2124
No known key found for this signature in database
GPG Key ID: 25AB36E3E81CBC26

@ -1677,6 +1677,7 @@ const App = memo(() => {
await loadMedia({ filePath: path, customOutDir: newCustomOutDir, projectPath });
}, [ensureAccessibleDirectories, loadMedia, storeProjectInWorkingDir]);
// todo merge with userOpenFiles?
const batchOpenSingleFile = useCallback(async (path) => {
if (workingRef.current) return;
if (filePath === path) return;

@ -285,7 +285,15 @@ export async function readFileMeta(filePath) {
'-of', 'json', '-show_chapters', '-show_format', '-show_entries', 'stream', '-i', filePath, '-hide_banner',
]);
const { streams = [], format = {}, chapters = [] } = JSON.parse(stdout);
let parsedJson;
try {
// https://github.com/mifi/lossless-cut/issues/1342
parsedJson = JSON.parse(stdout);
} catch (err) {
console.log('ffprobe stdout', stdout);
throw new Error('ffprobe returned malformed data');
}
const { streams = [], format = {}, chapters = [] } = parsedJson;
return { format, streams, chapters };
} catch (err) {
// Windows will throw error with code ENOENT if format detection fails.

Loading…
Cancel
Save