VideoHelp Forum




+ Reply to Thread
Results 1 to 7 of 7
  1. Member
    Join Date
    Jul 2011
    Location
    São Paulo, Brazil
    Search Comp PM
    Good evening...

    I was trying to find a faster/better scriptable way to hardsub some files I have than using avidemux and then ffmpeg, so I'm trying mencoder. The problem is that I don't understand the reason for this error:

    MEncoder 1.0rc4-4.5.2 (C) 2000-2010 MPlayer Team

    WARNING: OUTPUT FILE FORMAT IS _AVI_. See -of help.
    success: format: 0 data: 0x0 - 0x18c93ddd
    [mkv] Track ID 1: video (V_MPEG4/ISO/AVC) "V�deo", -vid 0
    [mkv] Track ID 2: audio (A_AAC) "�udio", -aid 0, -alang jpn
    [mkv] Track ID 3: subtitles (S_TEXT/ASS) "Legenda", -sid 0, -slang por
    [mkv] Will play video track 1.
    Matroska file format detected.
    VIDEO: [avc1] 1280x720 24bpp 23.976 fps 0.0 kbps ( 0.0 kbyte/s)
    [V] filefmt:31 fourcc:0x31637661 size:1280x720 fps:23.976 ftime:=0.0417
    Opening video filter: [expand osd=1]
    Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1
    Opening video filter: [dsize=640:360:0]
    ================================================== ========================
    Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
    Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
    ================================================== ========================
    Audio format 0x4134504d is incompatible with '-oac copy', please try '-oac pcm' instead or use '-fafmttag' to override it.
    Audio mediainfo for source file:

    Audio
    ID : 2
    Format : AAC
    Format/Info : Advanced Audio Codec
    Format profile : LC
    Codec ID : A_AAC

    Duration : 23mn 41s
    Channel(s) : 2 channels
    Channel positions : Front: L R
    Sampling rate : 48.0 KHz
    Compression mode : Lossy
    Title : �udio
    Language : Japanese
    My command line is: (with or without -lavfopts format=mp4 the result is the same)

    mencoder -endpos 20 -vf ass -vf dsize=640:360:0 -embeddedfonts -noskip -oac copy -ovc lavc -lavfopts format=mp4 -lavcopts vcodec=mpeg4:vqmin=2:vqmax=5:vbitrate=1000000 file.mkv -o teste.mp4

    If I force an aac reencode it works, how come it can't be copied? Also I don't know how to use the -fafmttag to force aac...

    OBS: Command line used to test the aac reencode:
    mencoder -endpos 20 -vf ass -vf dsize=640:360:0 -embeddedfonts -noskip -oac faac -faacopts quality=800 -ovc lavc -lavfopts format=mp4 -lavcopts vcodec=mpeg4:vqmin=2:vqmax=5:vbitrate=1000000 file.mkv -o teste.mp4


    I appreciate yout attention.
    Last edited by rzippert; 23rd Jul 2011 at 22:50.
    Quote Quote  
  2. DECEASED
    Join Date
    Jun 2009
    Location
    Heaven
    Search Comp PM
    AAC is a Variable Bit-Rate audio format. Even though the AVI container does support VBR audio, the Mencoder authors still live in the VfW-compatibility era.

    As for the issue with the MP4 container, I'm unable to explain that.
    Try re-encoding only the video with mencoder,
    then remux with the original audio through mp4creator or mp4box.
    Quote Quote  
  3. Member
    Join Date
    Jul 2011
    Location
    São Paulo, Brazil
    Search Comp PM
    Unfortunately these are windows tools... I'm under linux. Right now I'm reencoding the audio (seems to be enough for now), but I'm still curious about that error. Will try mencoder users mailing list. Does anybody see that I'm doing something wrong there?
    Quote Quote  
  4. DECEASED
    Join Date
    Jun 2009
    Location
    Heaven
    Search Comp PM
    Unfortunately these are windows tools...
    I'm afraid you are wrong this time.
    Both mp4box and mp4creator were originally written for Linux,
    anyone can compile their publicly-available source-code.
    Quote Quote  
  5. Member
    Join Date
    Jul 2011
    Location
    São Paulo, Brazil
    Search Comp PM
    Oh... I clicked on the links from this forum and it says windows only there... o.o
    Quote Quote  
  6. Member
    Join Date
    Jul 2011
    Location
    São Paulo, Brazil
    Search Comp PM
    Well... MP4Box worked for me. I'm gonna leave the command lines I'm using if someone comes by searching for such alternative:

    I'm encoding for my cell phone (Nokia 5530), a Symbian phone, however this might work with any other smartphone without much changing. The video is not absolutely perfect but very nice at this bitrate.

    First used mencoder to convert the video stream and hardsub it:
    Code:
    mencoder -vf ass,dsize=640:360:0,scale=-3:360 -embeddedfonts -noskip -nosound -ovc lavc -lavcopts vcodec=mpeg4:vqmin=2:vqmax=10:vbitrate=1000000 input.mkv -o output.avi
    Then mkvtoolnix to extract the original aac audio:
    Code:
    mkvextract tracks input.mkv 2:output.aac
    Third I use MP4Box to add the video and audio tracks to an mp4 file:
    Code:
    MP4Box -add output.aac final.mp4
    MP4Box -add output.avi final.mp4
    As another comment I found out that even when I reencoded the audio at that first try, the generated mp4 mencoder file had missing headers for both tracks, so even though I could play it in SMPlayer, my cell phone couldn't.

    If I find any more info on these issues I'll reply here again. Many thanks for the help until now.
    Quote Quote  
  7. You've probably already discovered that using FFMPEG for this is straightforward. For example...
    ffmpeg -i "rtmp://sdwfchwqitj2v.cloudfront.net:443/cfx/st/mp4:PBS_CP_NOVA/NOVA3904_web16x9__866478.mp4" -acodec copy -vcodec copy "c:\users\username\desktop\Nova.flv"
    ...works just fine. You can set the output file to be ~/Leonardo.mp4 and most processors can handle the remuxing in real time (but you can't use VLC to monitor the file as it's being written since the container metadata will be incomplete).

    You won't be so lucky with MENCODER because it wants to output only to .avi files. If you want it to output to any other container type, you have to instruct MENCODER to go through libavcodec using -of lavf ...then libav will determine the container you want through the extension of your output filename. However, once libav hands the ball back to MENCODER, it still assumes you are trying to fit an .aac audio stream into an .avi container--that's why you get the message...
    Originally Posted by rzippert View Post
    Audio format 0x4134504d is incompatible with '-oac copy', please try '-oac pcm' instead or use '-fafmttag' to override it.
    ... to force MENCODER to go through with containering the .aac track, you need to use -fafmttag 0x706D \ . Don't ask me what the argument <0x706D \ > means; I suspect it just refers to aac. It is important to preserve the space both before and after the backslash, though. Altogether, the syntax should look like this...
    mencoder "rtmp://sdwfchwqitj2v.cloudfront.net:443/cfx/st/mp4:PBS_CP_NOVA/NOVA3904_web16x9__866478.mp4" -of lavf -oac copy -fafmttag 0x706D \ -ovc copy -o "c:\users\username\desktop\Leonardo.flv"
    The force audio format tag command allows you to output .aac into the container of your choice, whether it's .mp4 or .mkv; my example uses .flv because the resulting output file can be monitored in real time.

    IMHO, this issue is insufficiently documented. The MENCODER manpage at http://www.mplayerhq.hu/DOCS/HTML/en/menc-feat-streamcopy.html is of very little help.

    EDIT: According to http://www.mplayerhq.hu/DOCS/codecs-status.html#ac, 0x706D is one of the FOURCC codes for FFmpeg AAC (MPEG-2/MPEG-4 Audio) Codec.
    Last edited by sandw1ch; 2nd Feb 2014 at 21:40.
    Quote Quote  



Similar Threads

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