I'm converting a video to MPG and the output has NO audio. I know I should specify the audio stream but can't find how in the documentation.

I need MPEG as output container because I stream my videos in my web app using jsmpeg and that's the required format. Thanks in advance!

ffmpeg -i bunny.mp4 -f mpeg1video -vf scale=1600:900 -y bunny.mpg

jsmpeg doesn't say anything about being able to play audio - seems to be a video-only decoder.

If you run ffprobe bunny.mpg you can check if the output has audio or not. If your ffmpeg build has or is linked with libmp3lame or libtwolame, it will.

  • Thanks for the ffmpeg command. We actually implemented our own audio context, so jsmpeg can read a separate audio track and play it simultaneously to the video. I discovered the ffmpeg option "-target pal-dvd" and this keeps the audio. – Charlie Jan 7 '16 at 10:29
  • Isn't PAL DVD creating a MPEG-2 stream? Does jsmpeg decode that? – Gyan Jan 7 '16 at 10:39
  • Not sure about PAL DVD, but jsmpeg is decoding my videos right now. – Charlie Jan 7 '16 at 13:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.