VideoHelp Forum




+ Reply to Thread
Results 1 to 16 of 16
  1. Member
    Join Date
    May 2008
    Location
    United States
    Search Comp PM
    I'm looking for a command line method (or script) to perform a conversion from MPEG-2 to anything compatible with Divx Home Theater Profile, so they can be played on a Divx Certified player (not Ultra Certified).

    I have tried various incantations with ffmpeg, and although my output is reported as divx with no qpel or gmc, they won't play on my player. Does anyone know what options to give ffmpeg to create a Home Theater Profile compatible output file? Or another command line based conversion tool, with a sample invocation? Primarily I am converting 4:3 sources, 640x480, with minimal fast action sequences (think home movies as a reference).

    Most of what I find for conversions with profiles use a GUI. Due to the volume involved, I want to use CLI instead of manually building a list to batch. The conversion would be done under WinXP (32 bit) with a quad core Q6700.
    Quote Quote  
  2. Banned
    Join Date
    Jun 2007
    Location
    UNREACHABLE
    Search Comp PM
    You might try mencoder, which is able to call the DivX/XviD's vfw DLLs.

    { http://www.mplayerhq.hu/DOCS/man/en/mplayer.1.html }
    Quote Quote  
  3. Member Soopafresh's Avatar
    Join Date
    Jan 2004
    Location
    United States
    Search Comp PM
    What model player do you have? Download AVIcheck http://fer.peque.org/avicheck.htm and post a screenshot of one of your non working files.
    Quote Quote  
  4. Member
    Join Date
    May 2008
    Location
    United States
    Search Comp PM
    Originally Posted by Soopafresh
    What model player do you have? Download AVIcheck and post a screenshot of one of your non working files.
    I am using a Toshiba D-VR600, which plays things converted by the likes of Dr Divx just fine. Interestingly, trying AviCheck against a non working file converted by one of my ffmpeg attempts, I get an error message "Average audio bitrate is 0", yet MediaInfo does not tell me the same thing. The file also plays fine with numerous PC players I have tried. Here is a AviCheck screenshot:



    and here is MediaInfo for the exact same file:

    Quote Quote  
  5. Member
    Join Date
    May 2005
    Location
    Toronto ||*||
    Search Comp PM
    I would recommend you close GOPs when using ffmpeg. for example, try this: ffmpeg -i "input" -s vga -vcodec libxvid -bf 1 -b 850k -mbd 2 -g 300 -flags cgop -acodec libmp3lame -ab 128k -ac 2 "output.avi"

    If you want to deinterlace use the -deinterlace option.

    This will create a divx file with the fourCC set to XVID.

    Try it.
    Quote Quote  
  6. Member Soopafresh's Avatar
    Join Date
    Jan 2004
    Location
    United States
    Search Comp PM
    Weird. Looks like it would work. If you wouldn't mind, download AVI_Gain from https://forum.videohelp.com/topic314909.html and run your file through any of the normalizing batch files. When the file gets remuxed, the DivX 4CC gets added to the file. Maybe it's that.
    Quote Quote  
  7. Member
    Join Date
    May 2008
    Location
    United States
    Search Comp PM
    Originally Posted by Soopafresh
    Weird. Looks like it would work. If you wouldn't mind, download AVI_Gain from https://forum.videohelp.com/topic314909.html and run your file through any of the normalizing batch files. When the file gets remuxed, the DivX 4CC gets added to the file. Maybe it's that.
    Thanks for the suggestion.

    I used the AVI_GAIN_Regular.BAT option. That did clear up the AviCheck issue of claiming the audio bitrate was 0. However, the video still would not play. See also my reply to VirtualDoobMon.
    Quote Quote  
  8. Member
    Join Date
    May 2008
    Location
    United States
    Search Comp PM
    Originally Posted by VirtualDoobMon
    I would recommend you close GOPs when using ffmpeg. for example, try this: ffmpeg -i "input" -s vga -vcodec libxvid -bf 1 -b 850k -mbd 2 -g 300 -flags cgop -acodec libmp3lame -ab 128k -ac 2 "output.avi"
    Maybe my biggest problem here is I am using -vcodec mpeg4 instead of libxvid, and -acodec mp3 instead of libmp3lame. But neither libxvid nor libmp3lame are valid codecs on my WinXP system. All but one of the various builds of ffmpeg I have did not like the -flags option either. The one that did would not process the file, but again maybe that is due to use of mpeg4 vs libxvid.

    I installed the latest ffmpeg I could find, SVN-r12920, which is about two weeks old. It didn't like -flags either.

    But I can't find where to get libxvid or libmp3lame for a WinXP system. I found a xvidcore-1.1.3.zip file which is also two weeks old, but from what I can tell it doesn't give me the libxvid encoder either.

    I must not be googling the right search terms, as I can't find how to install support for libxvid or libmp3lame under WinXP. Can anyone point me in the right direction?
    Quote Quote  
  9. Banned
    Join Date
    Jun 2007
    Location
    UNREACHABLE
    Search Comp PM
    It seems you don't like mencoder.
    Could you please say why
    Quote Quote  
  10. Member Soopafresh's Avatar
    Join Date
    Jan 2004
    Location
    United States
    Search Comp PM
    Install WinFF . It has many different profiles which might to the job. You can copy the command line parameters if one of them works for you. Or WinMenc for Mencoder. http://winmenc.blogspot.com/
    Quote Quote  
  11. Member
    Join Date
    May 2008
    Location
    United States
    Search Comp PM
    Originally Posted by Midzuki
    It seems you don't like mencoder.
    Could you please say why
    Lack of experience; I am much more familiar with ffmpeg options and get pretty good performance from it on my quad core. Since my output had neither qpel nor gmc, I thought I was probably just missing something really simple to add to my ffmpeg command line.

    But I am going to try mencoder too -- I just have to experiment with the options to give it.
    Quote Quote  
  12. Member Soopafresh's Avatar
    Join Date
    Jan 2004
    Location
    United States
    Search Comp PM
    Try this version of ffmpeg. I included an example command line usage batch file - modify it for your file type that you're converting and the file dimensions

    ffmpeg_xvid.rar

    With Winmenc, you can save the batch file once you've found the correct config:

    http://www.badongo.com/file/3605671



    Quote Quote  
  13. Member
    Join Date
    May 2008
    Location
    United States
    Search Comp PM
    An update for the sake of the archives, or anyone who cares:

    Using the ffmpeg linked above or the version with WinFF, I was able to produce videos which would play but I still had these issues:
    • - AviCheck still reported my audio bitrate as 0, and I would not get any sound from a Divx certified player
      - I could correct the above using the avi_gain scripts (and could probably coerce ffmpeg to do it the first time if I messed with it)
      - The avg video bitrate would come out quite a bit higher than I requested on the command line, which threw off my calcs for a desired target size
      - The video would not fast forward or rewind on a Toshiba D-VR600 (only play) but would FF and rewind on a Toshiba SD-K850

    So I played with various mencoder options, and it looks like I will be settling on it. When I use two-pass mode, it does very good at hitting my requested bitrate so I can run pretty tight tolerances on my target size. The video will play, FF, and rewind on both the Divx certified players I have at my disposal (Toshiba D-VR600 and SD-K850). I may do more tweaks, but for the record, here are my current CLI arguments I am using:

    Pass 1:

    mencoder.exe "(input)" -ffourcc XVID -vf-add scale=640:480 -ovc xvid -xvidencopts profile=dxnhtntsc:bitrate=xxxx:threads=4:turboass=1 -nosound -o NUL;

    Pass 2:

    mencoder.exe "(input)" -ffourcc XVID -vf-add scale=640:480 -ovc xvid -xvidencopts profile=dxnhtntsc:bitrate=xxxx:threads=4ass=2 -srate 44100 -oac mp3lame -lameopts cbr:br=128:mode=0 -o "(output).avi"

    I am using threads=4 since I have a quad core Q6700, but my CPU only averages a little above 50%. All four cores are in use but none are maxed out. Can mencoder take advantage of more threads than you have CPU cores?
    Quote Quote  
  14. Member
    Join Date
    Dec 2004
    Location
    Triptonia
    Search Comp PM
    All but one of the various builds of ffmpeg I have did not like the -flags option either. The one that did would not process the file, but again maybe that is due to use of mpeg4 vs libxvid.
    no it's not,

    try the latest build at Ramiro's


    tripp
    Quote Quote  
  15. Member
    Join Date
    May 2005
    Location
    Toronto ||*||
    Search Comp PM
    if you're using mpeg4 with ffmpeg don't use b-frames but make sure you set your GOPs and the
    ffourcc to XVID or DX50.
    if you want to encode to xvid with ffmpeg then the example i gave earlier will work.

    As stated by others, use current builds of ffmpeg. With the newer builds you will have to use
    Libxvid instead of just xvid and libmp3lame in place of mp3.

    mencoder will of course work as well but i have found with the profiles sometimes the file
    won't playback on certain standalones. If this is ever the case for you just rebuild the index.
    ie: mencoder -ovc copy -oac copy -forceidx input -o output

    If that doesn't work use avimux_gui and use the standalone with mp3 profile.

    cheers
    Quote Quote  
  16. Member
    Join Date
    May 2008
    Location
    United States
    Search Comp PM
    Thanks for all the suggestions. I may try another ffmpeg build for comparisons, but so far it looks like mencoder will do what I want. It is running lower CPU utilization than I'd expect, but increasing the threads count for the xvidencopts doesn't seem to improve performance that much, nor increase the CPU utilization that much. I have a quad core Q6700, so initially set the -threads to 4. The mencoder docs list -xvidencopts threads=x description is:

    Create n threads to run the motion estimation (default: 0). The maximum number of threads that can be used is the picture height divided by 16.
    In ffmpeg, I'd create 4 threads because I have four cores. In mencoder, threads seem to be used differently with xvid anyway. If I increase the threads to 8 or even 12, I don't see a noticeable impact in speed or even in cpu utilization.

    I'm seeing times around 110-120fps for pass 1 and 55-60fps for pass 2, so the net effect is I process around 45fps. Thus the compression takes roughly 2/3 of the play time for a video. I can live with that if I need to, but wouldn't object to an increase if anyone can see anything I could change with the sample command line listed above. I am using mencoder dev-SVN-r23237-3.4.2 which reports:

    MEncoder dev-SVN-r23237-3.4.2 (C) 2000-2007 MPlayer Team
    CPU: Intel(R) Core(TM)2 Quad CPU Q6700 @ 2.66GHz (Family: 6, Model: 15, Step
    ping: 11)
    CPUflags: Type: 6 MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
    Compiled with runtime CPU detection.
    So it seems this version is fully aware of my quad core capabilities. Yet even with threads=4 (or 8 or 12), my total cpu utilization is under 30%. Maybe I'm just used to the way ffmpeg can max out each core, but shouldn't it be more CPU bound than this?
    Quote Quote  



Similar Threads

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