Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Demux an mp4

  1. #1
    Join Date
    May 2008
    Location
    Moscow, Russia
    Beans
    109
    Distro
    Ubuntu 12.04 Precise Pangolin

    Demux an mp4

    Okay, so here is an mp4 file that contains a video stream in H264 format and an audio stream in AAC format. Is there an easy linux way to extract these two streams and reencode them individualy into something less exotic? Like get an .m2v video file and a .wav audio file?

  2. #2
    Join Date
    Aug 2006
    Location
    /media/party
    Beans
    Hidden!
    Distro
    Kubuntu 11.10 Oneiric Ocelot

    Re: Demux an mp4

    Avidemux allows you to separate audio and video and convert them into different formats. To do the audio, select your audio type from the drop-down list on the left, configure to your exact needs and then use the Audio -> Save menu item.

    The video can be done by changing the main audio track to "none" then selecting the appropriate video codec for your needs - then you save it. You'll then have the two separate streams you asked for.
    Attached Images Attached Images
    <<< ADVERTISE HERE >>>

  3. #3
    Join Date
    Sep 2006
    Beans
    3,483

    Re: Demux an mp4

    FFmpeg can do this as well. For the audio:
    Code:
    ffmpeg -i input.mp4 output.wav
    And now the video:
    Code:
    ffmpeg -i input.mp4 -sameq output.m2v
    You will need the libavcodec-unstripped-51 package in addition to ffmpeg to activate restricted encoders such as mpeg2video, libfaac, libmp3lame, mpeg4, etc.

  4. #4
    Join Date
    May 2008
    Location
    Moscow, Russia
    Beans
    109
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Demux an mp4

    Thank you very much for the advice! The ffmpeg way turned out to be even easier than avidemux, because I got all confused choosing the right video codec in the left-hand panel.

    The weird thing with ffmpeg, though, is that the frame size of the saved video track became a bit smaller than the original, so the peripheral part of the image was cut off. Is there any way I could tune the frame size?

  5. #5
    Join Date
    Sep 2006
    Beans
    3,483

    Re: Demux an mp4

    Quote Originally Posted by azangru View Post
    The weird thing with ffmpeg, though, is that the frame size of the saved video track became a bit smaller than the original, so the peripheral part of the image was cut off. Is there any way I could tune the frame size?
    That's odd because it shouldn't change the frame size unless you tell it to. Paste your FFmpeg command and the full output. You can specify frame size with the -s option: -s 640x480 for example.

  6. #6
    Join Date
    May 2008
    Location
    Moscow, Russia
    Beans
    109
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Demux an mp4

    Ok, I re-checked and it turned out I was wrong. The frame size in the m2v output is correct; the cutting of the frame occurs when I import the m2v file in Adobe Premiere on another computer.

  7. #7
    Join Date
    Sep 2006
    Beans
    3,483

    Re: Demux an mp4

    Quote Originally Posted by azangru View Post
    Ok, I re-checked and it turned out I was wrong. The frame size in the m2v output is correct; the cutting of the frame occurs when I import the m2v file in Adobe Premiere on another computer.
    Perhaps Premiere is choosing the incorrect aspect ratio. In Premiere, right click on a video file, choose Interpret Footage -> Conform to: and choose your aspect ratio.

  8. #8
    Join Date
    May 2008
    Location
    Moscow, Russia
    Beans
    109
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Demux an mp4

    I imported another version of the video file in Premiere, and now the frame size remained normal. The difference from the previous version was that this time it was not high-definition. Perhaps, Premiere was having problems with high def. That's all right, though; I didn't really need high definition.

    Thank you very much for the help!

  9. #9
    Join Date
    Oct 2008
    Location
    Chennai, India
    Beans
    11
    Distro
    Ubuntu

    Thumbs up Re: Demux an mp4

    Worked like a magic!!! Thanks.

    Quote Originally Posted by FakeOutdoorsman View Post
    FFmpeg can do this as well. For the audio:
    Code:
    ffmpeg -i input.mp4 output.wav
    And now the video:
    Code:
    ffmpeg -i input.mp4 -sameq output.m2v
    You will need the libavcodec-unstripped-51 package in addition to ffmpeg to activate restricted encoders such as mpeg2video, libfaac, libmp3lame, mpeg4, etc.

  10. #10
    Join Date
    Sep 2006
    Beans
    3,483

    Re: Demux an mp4

    Quote Originally Posted by FakeOutdoorsman View Post
    And now the video:
    Code:
    ffmpeg -i input.mp4 -sameq output.m2v
    You will need the libavcodec-unstripped-51 package in addition to ffmpeg to activate restricted encoders such as mpeg2video, libfaac, libmp3lame, mpeg4, etc.
    Unfortunately, this is incorrect.-sameq does not mean "same quality", and anyway this option has been removed upstream. Instead:
    Code:
    ffmpeg -i input -qscale:v 2 output.mpg
    This is an ancient thread, and old information is often outdated, and I can't edit the old post and fix it (a major annoyance about these forums).

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •