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

Support audio-only #1

Open
tfsjohan opened this issue Jan 6, 2021 · 3 comments
Open

Support audio-only #1

tfsjohan opened this issue Jan 6, 2021 · 3 comments

Comments

@tfsjohan
Copy link

tfsjohan commented Jan 6, 2021

Can I use this to convert webm audio file to a audio mp4 file? Don't need video, just audio.

@Richienb
Copy link
Owner

Richienb commented Jan 6, 2021

It didn't know that mp4 was an audio format - I have no idea if it will work.

@oscarguinane
Copy link

oscarguinane commented Feb 11, 2021

You can apt install ffmpeg and run the following code below in NodeJS.

const exec = require( 'child_process' ).exec;

function convertWebmToMP4 ( filePath ) {
  exec( 
    `ffmpeg -i "${ filePath }" "${ filePath.replace( /.webm/, '.mp4' ) }"`, 
    function( error, stdout, stderr ) {
      if ( error )
        console.error( `Got an error trying to convert the file: ${ error }` );
      else
        console.log( stdout );
    } 
  );
}

convertWebmToMP4( `${ process.env.PWD }/tmp/file.webm` );

( Tested in NodeJS 14.13.1 )

@Richienb
Copy link
Owner

Accepting a PR to conditionally add -vn (skip inclusion of video flag) when an option is passed.

@Richienb Richienb changed the title Does this work for audio-only? Support audio-onl Feb 11, 2021
@Richienb Richienb changed the title Support audio-onl Support audio-only Feb 11, 2021
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

3 participants