Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MP4 Transcoding Error: Invalid Data Found When Processing Input #10

Open
aliassan opened this issue Jul 9, 2023 · 2 comments
Open

MP4 Transcoding Error: Invalid Data Found When Processing Input #10

aliassan opened this issue Jul 9, 2023 · 2 comments

Comments

@aliassan
Copy link

aliassan commented Jul 9, 2023

I've noticed if I try to stream an MP4 file to DASH using ffmpeg-worker-dash.js I get the following error:

/work/stream1: Invalid data found when processing input

However if I use WebM it transcodes successfully without the error, does this have to do with MP4 not being enabled by default? If so how to enable?

@002love
Copy link

002love commented Jul 9, 2023

The error message you encountered ("Invalid data found when processing input") suggests that there may be an issue with the MP4 file you're trying to stream using ffmpeg-worker-dash.js. It's possible that the file is corrupted or not in a format that ffmpeg-worker-dash.js can handle properly.

Regarding the format support, ffmpeg, the underlying tool used by ffmpeg-worker-dash.js, typically has support for both MP4 and WebM formats. However, it's important to note that the specific capabilities of ffmpeg can depend on the version and configuration used.

To troubleshoot the issue, you can try the following steps:

Verify the integrity of the MP4 file:

Check if the MP4 file is valid and not corrupted. You can try playing the file locally on your computer using a media player to ensure it's working correctly.

Check the version and configuration of ffmpeg:

Make sure you're using an up-to-date version of ffmpeg. Different versions may have varying levels of support for different formats. You can check the version by running the command ffmpeg -version in your terminal or command prompt.

Enable MP4 support:

If you have a custom build of ffmpeg or if the version you're using doesn't have MP4 support enabled by default, you may need to rebuild ffmpeg with the necessary codecs and libraries enabled. You can refer to the ffmpeg documentation or community resources for instructions on how to enable MP4 support during the build process.

Test with other MP4 files:

Try using different MP4 files to see if the issue persists. This can help determine if the problem is specific to the file you initially attempted to stream.

If you continue to experience difficulties, it may be helpful to provide more specific information about your environment, such as the version of ffmpeg you're using and the command or code you're running, so that further assistance can be provided.

@aliassan
Copy link
Author

aliassan commented Jul 9, 2023

I've tried the video file, it works fine, I've also tried different MP4 video files and they report the same error. If I convert the video to WebM it then works fine. I'm using FFmpeg version n5.1, the Emscripten build from the davedoesdev/ffmpeg.js repository. This is the command I'm trying to run:

worker.postMessage({
    type: "run",
    arguments: [
        '-re', '-i', '/work/stream1', '-map', '0', '-map', '0', '-map', '0', '-c:a', 'aac', '-c:v', 'libx264',
        '-b:v:0', '800k', '-b:v:1', '300k', '-s:v:1', '320x170', /*'-profile:v:1', 'baseline',
        '-profile:v:0', 'main',*/ '-bf', '1', '-keyint_min', '120', '-g', '120', /*'-sc_threshold', '0',
        '-b_strategy', '0',*/ '-ar:a:1', '22050', '-use_timeline', '1', '-use_template', '0', 
        '-adaptation_sets', "id=0,streams=v id=1,streams=a", '-f', 'dash'
        , '/outbound/out.mpd'
    ],
    MEMFS: [{name: "stream1"}, {name: "stream2"}]
}); 

It's supplied with data like so:

worker.postMessage({
    type: "stream-data",
    name: "stream1",
    data: testData.buffer
}, [testData.buffer])

Where testData.buffer happens to be an ArrayBuffer of the video content. The above works with WebM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants