VideoHelp Forum

Try DVDFab and copy Ultra HD Blu-rays and DVDs! Or rip iTunes movies and music! Download free trial !
+ Reply to Thread
Results 1 to 9 of 9
Thread
  1. Member
    Join Date
    Jan 2018
    Location
    United States
    Search PM
    Hello

    I'm looking for a little guidance. I have .m4v files with two audio tracks. The first track is AAC and second is AC3. I prefer the AC3 track and would prefer to reorder the audio tracks so that AC3 is default.

    When I run the file through mkvtoolnix, it works beautifully and quickly (like 2.5 minutes for a 5 gb file). It does exactly as I described above. The problem then becomes, the file is now .mkv. That's not terrible except, I can no longer have my cover art show in Windows. I'm sure there are long-winded solutions that involved encoding for hours. If someone had say, 2000+ files of 5gb each, well that will take a while.

    My question is, how can I re-order audio tracks without changing from .m4v to .mkv?

    Also, I've tried saving the output file as .m4v, but the cover art software I use, MetaX, cannot open the file to add the art. I'm guessing that means its not a "true" .m4v file, just an extension change.

    Worse-case scenario is I learn to live with no cover art in Windows file explorer. I'm told that using Kodi (while using correct file name format) will display its own cover art, so that's something.

    Thank you in advance for any assistance.

    Tyler
    Quote Quote  
  2. Member
    Join Date
    Jan 2018
    Location
    United States
    Search PM
    Thank you for the speedy reply @sneaker

    I have ffmpeg installed. I (finally) figured out how to get it to "do stuff". However, I'm getting an error message when I try your suggestion above. Is there something about .m4v not playing nice in ffmpeg?

    Here's what I used:
    ffmpeg -i "file01.m4v" -map 0:v -map 0:a:1 -map 0:a:0 -c copy "file09.m4v"

    It returned with an error message and a 0kB file titled "file09.m4v"

    Error: "[ipod @ 00000249e5b0fd40] Could not find tag for codec mjpeg in stream #1, codec not currently supported in container
    Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument"
    ----
    screenshot

    Image
    [Attachment 44436 - Click to enlarge]
    Last edited by tylergarey; 18th Jan 2018 at 22:10. Reason: fix spacing
    Quote Quote  
  3. It seems ffmpeg cannot handle mjeg in mp4. Is that the cover art? If so copy without mjpeg:
    ffmpeg -i "file01.m4v" -map 0:v:0 -map 0:a:1 -map 0:a:0 -map 0:s:0 -c copy "file09.m4v"

    Then afterwards add cover again.
    Quote Quote  
  4. Member
    Join Date
    Jan 2018
    Location
    United States
    Search PM
    Yes, you were correct. It worked fine with the new command that you suggested. I was able to add the cover back afterwards. 100 thank yous

    Two more things,

    -Although my audio tracks are now in the correct order, 1) AC3 and 2) AAC, VLC player is defaulting to the AAC track (track 2). I remember in mkvtoolnix there was a way to flag an audio track as default. Is there a way to designate the default track with ffmpeg?

    -The other thing is batch work. Specifically if I had to do several files at a time, is there a way to queue it up or would that be too complex of a code?
    Quote Quote  
  5. Member
    Join Date
    Jan 2018
    Location
    United States
    Search PM
    Update. I was able to find some information regarding how to set a default stream using ffmpeg. Here's what I've done,

    -I took the file with the corrected audio order (vlc defaults to 2nd track) and ran it through ffmpeg with this command:

    ffmpeg -i "file09.m4v" -disposition:a:0 default -c copy "file19.m4v"

    It works, but doesn't copy the 2nd track to the output file. Some of you will see this and think "What is he doing?". I've little experience with coding, I'm learning as I go and pretty much self teaching, except when given the answer (like you see above). Please be gentle.

    It's just another foreign language. I know what I want to say, but I need to "say" it correctly to reach my goal.

    At this point I am close to exactly what I need, I'm just missing a couple pieces. I want to take my File01.m4v and REORDER the audio, track 1 (AAC) is now track 2, AND REMOVE cover art, AND designate the newly appointed track 1 (AC3) as DEFAULT

    Is this something that can be done with one command?

    As far as the batch work question, I don't believe there's a good way to do several files at once, so I plan to do it manually a couple thousand times lol.

    Best regards

    Tyler
    Quote Quote  
  6. Just mush it all together:
    ffmpeg -i "file01.m4v" -map 0:v:0 -map 0:a:1 -map 0:a:0 -map 0:s:0 -disposition:a:0 default -c copy "file09.m4v"

    But will your player act on the flags? Different question...
    Quote Quote  
  7. Member
    Join Date
    Jan 2018
    Location
    United States
    Search PM
    Worked!

    Using the suggested command above, I was able to REORDER audio, REMOVE cover, and DEFAULT to the new audio track 1 (AC3). All I had to do is re-add the cover art with MetaX.

    I played the video via PC (VLC player), Xbox (media app), and Android phone (Bubble uPnP). All played the file correctly by defaulting to the new track 1.

    1,000 thank yous to @sneaker
    Quote Quote  
  8. Member
    Join Date
    Nov 2017
    Location
    Madrid, Spain
    Search PM
    Just for the next time, I recently wrote an ffmpeg Windows front-end that makes this stream muxing and reordering operations with default tracks very easy.

    https://www.videohelp.com/software/FFmpeg-Batch

    Cheers
    Quote Quote  



Similar Threads