VideoHelp Forum



Support our site by donate $5 directly to us Thanks!!!

Try StreamFab Downloader and download streaming video from Netflix, Amazon!



+ Reply to Thread
Results 1 to 23 of 23
  1. Member jraju's Avatar
    Join Date
    Mar 2013
    Location
    India
    Search Comp PM
    Hi, i could convert mkv files to mp4 using mkvtoolnix software.
    BUt i do not know how to customize my video output to h264 and audio to mp3 from the original video format in mkvtoolnix
    is that possible please
    Quote Quote  
  2. It's not possible with mkvtoolnix
    Quote Quote  
  3. Average video editor Sviests's Avatar
    Join Date
    Sep 2018
    Location
    USA,Sweden
    Search Comp PM
    Originally Posted by jraju View Post
    i could convert mkv files to mp4 using mkvtoolnix software...
    There is no actual difference if the file is .mp4 or .mkv ,it's just a container. Since MKVToolnix doesn't actually recode anything, you're not "converting" anything.
    The software is practically used to mux/demux audio/video streams,subtitles,chapters,etc or apend multiple files or split them (e.g. split by sizes or extract by specific timecodes).

    There's a comandline tool called FFMPEG, that actually can do everything you described.
    Quote Quote  
  4. Member jraju's Avatar
    Join Date
    Mar 2013
    Location
    India
    Search Comp PM
    Hi, sviests,
    Then please give the formula. i know something in ffmpeg
    i want to convert the video codec to x264 of h264 or h264 and audio to mp3.
    the original codec is advanced codec of video and audio which does not play in my tv, which ofcourse support mp3
    please only give the formula , and i will substitue with my input file
    Quote Quote  
  5. Try simply:
    Code:
    ffmpeg -i "inputfile" -ac 2 "outputfile.mp4"
    (This will select libx264 and aac encoders because those are the default formats for .mp4. -ac 2 will recode to stereo because not all TVs support multi-channel AAC.)


    If you absolutely want MP3 you can try:
    Code:
    ffmpeg -i "inputfile" -c:a libmp3lame "outputfile.mp4"
    Quote Quote  
  6. Code:
    ffmpeg -i "yourfile.mp4" -vcodec h264 -b:v 4000k -c:a mp3 -b:a 256k "output.mp4"
    bv is variable bitrate. choose what you prefer... (2000 or 3000, etc)
    ca is relative to audio: choose 128 or 192 or 256 or 320
    Quote Quote  
  7. Member jraju's Avatar
    Join Date
    Mar 2013
    Location
    India
    Search Comp PM
    hi, lomero, what if my file is not mp4, but mkv.
    Will ffmpeg realize mkv format.
    Hi, sneaker, you have given two formula, one for video and other for audio, is it not
    Could you combine both to get h264 and mp3
    hi, lomero, if mkv is reallized in formula, i will choose and try your formula, will select 2000and 128
    Quote Quote  
  8. Member jraju's Avatar
    Join Date
    Mar 2013
    Location
    India
    Search Comp PM
    hi, lomero, your formula works , but take long time to process and completlle.
    i used any video converter and selected the same parameters and converted it , its speed is very good .
    Thanks for all the help
    Quote Quote  
  9. first: if u have mkv (not mp4) simply use my string with this changement

    Code:
    ffmpeg -i "yourfile.mkv" -vcodec h264 -b:v 2000k -c:a mp3 -b:a 128k "output.mkv"
    second: very stange. i use ffmpeg to convert my video and it's very fast (not tested with mkv file...)
    Quote Quote  
  10. Originally Posted by jraju View Post
    hi, lomero, your formula works , but take long time to process and completlle.
    Of course. It's reencoding the video and audio. You can use faster encoder settings. The quality won't be as good though. Try preset verfast:

    Code:
    ffmpeg -i "yourfile.mkv" -vcodec h264 -preset veryfast -b:v 2000k -c:a mp3 -b:a 128k "output.mkv"
    I wouldn't use bitrate based encoding though. Use rate factor based encoding:

    Code:
    ffmpeg -i "yourfile.mkv" -vcodec h264 -preset veryfast -crf 20 -c:a mp3 -b:a 128k "output.mkv"
    Use a smaller value for higher quality, higher value for lower quality.
    Quote Quote  
  11. Originally Posted by jraju View Post
    Hi, i could convert mkv files to mp4 using mkvtoolnix software.
    BUt i do not know how to customize my video output to h264 and audio to mp3 from the original video format in mkvtoolnix
    is that possible please
    None of this is possible in MkvToolNix.

    You say you are trying to convert mkv to mp4? I assume you mean MPEG-4 Part 2 onwards > But with an Mp3 audio stream ?

    A compliant mp4 cannot contain an Mp3 audio stream. Is there any reason you need the audio stream to be mp3 ? What device will you be playing your mp4 on ?

    You don't have to re-encode anything, just convert its format, so will take minutes, not hours if you are seeking a 'normal' compliant mp4..

    With these default settings ffmpeg will produce a compliant mp4, which by definition, cannot contain an mp3 audio stream.

    Code:
    ffmpeg -i input.mkv -c copy output.mp4
    You would have to drop onto the 'old' MPEG-II format in order to use an Mp3 audio stream:

    Code:
    ffmpeg -i input.mkv -c:v mpeg2video -c:a mp3 output.mpg
    Maybe better if you install MediaInfo or MediaInfoLite. Post the output txt here of your Mkv file and tell us if you want it converting to a standard, compliant Mp4 or not.
    Last edited by codehound; 7th Jun 2020 at 12:57.
    Quote Quote  
  12. Member jraju's Avatar
    Join Date
    Mar 2013
    Location
    India
    Search Comp PM
    hi, codehound,
    i need mp3 audio, even vlc have it as the first default, as old say 2016 tv deos not support aac, if that is what you mean
    my tv does not play if the extension is mkv.
    it does play x-264 and mp3.
    if what you say is correct, the mp4 would not contain mp3, then why this is not played in tvs
    if your first code is taken, then, it may even just produce the converted file as opus audio, which is not supported by most of the 2016 model tvs.
    please clarify. mp4 cantainer can be anthing in audio like opus advanced codec.
    Quote Quote  
  13. Member jraju's Avatar
    Join Date
    Mar 2013
    Location
    India
    Search Comp PM
    HI, lomero,
    is that your clue that , after converting the file to mkv extension, i could just rename it as extension .mp4 to play, as the container inside your formula is for h264 and mp3 audio.
    Quote Quote  
  14. Originally Posted by jraju View Post
    HI, lomero,
    is that your clue that , after converting the file to mkv extension, i could just rename it as extension .mp4 to play, as the container inside your formula is for h264 and mp3 audio.
    No. But you can simply change the output file extension on the ffmpeg command line to mp4 to directly create an mp4 file:

    Code:
    ffmpeg -i "yourfile.mkv" -vcodec h264 -preset veryfast -crf 20 -c:a mp3 -b:a 128k "output.mp4"
    It's my understanding that mp3 has been officially supported in mp4 for several years now. In any case, if your TV only plays mp3 audio in mp4 then you have no choice.
    Quote Quote  
  15. Originally Posted by codehound View Post
    A compliant mp4 cannot contain an Mp3 audio stream.
    .
    .
    .
    With these default settings ffmpeg will produce a compliant mp4, which by definition, cannot contain an mp3 audio stream.
    Yes it can.


    mp3 (mpeg-2 layer 3) audio is definitely and officially compatible in mp4 (mpeg4 part 14) container, as per ISO specs

    It was added in 2005 in ISO14496-3 MPEG-4 Part 3, subpart 9 (MPEG-1/MPEG-2 audio in MPEG4)
    Quote Quote  
  16. Originally Posted by poisondeathray View Post
    Originally Posted by codehound View Post
    A compliant mp4 cannot contain an Mp3 audio stream.
    .
    .
    .
    With these default settings ffmpeg will produce a compliant mp4, which by definition, cannot contain an mp3 audio stream.
    Yes it can.


    mp3 (mpeg-2 layer 3) audio is definitely and officially compatible in mp4 (mpeg4 part 14) container, as per ISO specs

    It was added in 2005 in ISO14496-3 MPEG-4 Part 3, subpart 9 (MPEG-1/MPEG-2 audio in MPEG4)
    You try getting an Mp4 to work with Mp3 audio on an older TV...
    Quote Quote  
  17. Originally Posted by codehound View Post

    You try getting an Mp4 to work with Mp3 audio on an older TV...

    That's not the same thing as "by definition cannot contain an mp3 audio stream"

    By definition, it can - and it's 100% compliant with specs


    If some TV manufacturer chooses not to implement support, that's a different topic
    Quote Quote  
  18. Originally Posted by jraju View Post
    Hi, sviests,
    Then please give the formula. i know something in ffmpeg
    i want to convert the video codec to x264 of h264 or h264 and audio to mp3.
    the original codec is advanced codec of video and audio which does not play in my tv, which ofcourse support mp3
    please only give the formula , and i will substitue with my input file
    If the video codec is supported (x264 as stated) you can convert the audio stream only.
    Use my clever FFmpeg-GUI, load your video. Set Audio modify, convert to mp3. In the multiplex section set your video as videostream, the new created mp3 as audiostream an remux as mp4. This file should play fine on your TV.
    Quote Quote  
  19. Originally Posted by ProWo View Post
    If the video codec is supported (x264 as stated) you can convert the audio stream only.
    For the OP: You can do that with ffmpeg directly with:

    Code:
    ffmpeg -i "yourfile.mkv" -c:v copy -c:a mp3 -b:a 128k "output.mp4"
    Quote Quote  
  20. I don't spend my life studying codec compliance and properties, so if someone cleverer than me says that Mp3 audio is now compliant in an Mp4 then I bow to their better knowledge. And, in that case jagabo's ffmpeg syntax should surely work.
    Quote Quote  
  21. Member jraju's Avatar
    Join Date
    Mar 2013
    Location
    India
    Search Comp PM
    hi codehound, it was humble on your part. i found the compatabie in vlc and so i replied that way.
    Moreover, if i change only the audio, the advanced mp4 video codec are not supported in older model.
    That is why , i prefer h264 and mp3 audio. my tv suppport mp3 but not aac.
    i tried vlc , but it is mostly not saving correctly the subtitle as per the tutorial. mkvtoolnix came in handy in that aspect in embedding subtitles, but mkv does not allow changes in the video and auiio codec. So, what i am doing is just adding subtitle if necessary in mkvtoolnix and then using avc, i convert to comapatible h264, ie.x264 mp3 format.
    regarding ffmpeg conversion , it takes more minutes than avc
    Quote Quote  
  22. Originally Posted by jraju View Post
    regarding ffmpeg conversion , it takes more minutes than avc
    ffmpeg with video in copy mode shouldn't take much time at all. For example, I ran a quick test: a 90 minute, 4+ GB, 1080p video, took about 1.5 minutes.
    Last edited by jagabo; 8th Jun 2020 at 22:36.
    Quote Quote  
  23. Originally Posted by jraju View Post
    Moreover, if i change only the audio, the advanced mp4 video codec are not supported in older model.
    That is why , i prefer h264 and mp3 audio. my tv suppport mp3 but not aac.
    h264 encoder gives x264 encoded (AVC) files. Maybe you mean h263 encoder.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!