VideoHelp Forum




+ Reply to Thread
Results 1 to 10 of 10
  1. I am new to the forum and would greatly appreciate your help with this!

    I have been processing short (less than 3 minutes, but mostly up to 1 minute) video clips for a video display system that only accepts XVID compressed AVI files.

    The processing I need to do is:
    - Resize the video to specific non-standard cpixel dimensions; the final size is just short of 16:9, so it usually means cropping or adding a small amount of letterboxing
    - Compress using XVID codec
    - Process the audio; very often the audio is too low, so I need to at least amplify and often put it through a limiter - I do this separately in Audacity, save out as mp3 and then swap out the original audio when I resize.

    Because the target was AVI, all the above could be done pretty easily using VirtualDub, and it all worked reasonably well.

    Now, the target system has changed and I need to do the same processing (excluding the XVID compression), but output an MPEG-2 file. In an ideal world, VirtualDub would have an option to save as MPEG-2 and I would not be writing this post, but as far as I can tell, it does not.

    So I would like to tap into your collective wisdom for any suggestions you might have as to how I could make this transition to MPEG-2 as painless (both for the workflow and the pocketbook, as I am spoiled by having used freeware) as possible, while maintaining the quality of the original as much as possible.

    Thanks very much in advance for your help!
    Quote Quote  
  2. Originally Posted by Randolphe Prince View Post
    I am new to the forum and would greatly appreciate your help with this!

    I have been processing short (less than 3 minutes, but mostly up to 1 minute) video clips for a video display system that only accepts XVID compressed AVI files.

    The processing I need to do is:
    - Resize the video to specific non-standard cpixel dimensions; the final size is just short of 16:9, so it usually means cropping or adding a small amount of letterboxing
    - Compress using XVID codec
    - Process the audio; very often the audio is too low, so I need to at least amplify and often put it through a limiter - I do this separately in Audacity, save out as mp3 and then swap out the original audio when I resize.

    Because the target was AVI, all the above could be done pretty easily using VirtualDub, and it all worked reasonably well.

    Now, the target system has changed and I need to do the same processing (excluding the XVID compression), but output an MPEG-2 file. In an ideal world, VirtualDub would have an option to save as MPEG-2 and I would not be writing this post, but as far as I can tell, it does not.

    So I would like to tap into your collective wisdom for any suggestions you might have as to how I could make this transition to MPEG-2 as painless (both for the workflow and the pocketbook, as I am spoiled by having used freeware) as possible, while maintaining the quality of the original as much as possible.

    Thanks very much in advance for your help!
    MPEG PS or TS? You may do this in same way, at the end add only one step ffmpeg (AVI to PS/TS remuxing).
    Above for XVid, if your intention is to receive MPEG-2(1?) video and audio then everything will be slightly different.
    So please specify in a clear way - what kind of source type you have and what is expected at the end (container type and codecs).
    I assume Avisynth will be most flexible way to solve most of your problems (even audio can be processed in one time with video).

    Aaaa and personally i would prefer ffmpeg but in terms MPEG-2 video quality seem that HcEnc is better (but avs input expected).
    Quote Quote  
  3. Member
    Join Date
    Aug 2013
    Location
    Central Germany
    Search PM
    To achieve high compatibility with consumer disc players, you may be interested in authoring a "DVD Video". But this media format is a lot more than just another kind of media file, it is a whole structure of logical and physical media. Converting to MPEG-2 video (with several constraints) is only one part of a whole process. The audio stream needs to comply to several constraints too (e.g. can't be MP3, but should be AC3 = Dolby Digital in a certain bitrate range). And finally, a "DVD authoring tool" needs to build the logical structure of directories with VOB and IFO/BUP files, even if you don't need menus. Fortunately, the VideoHelp Downloads offer a range of freeware in this area too. By the way, VOB segments are a kind of MPEG PS (ProgramStream) containers with special content to support DVD navigation.

    If you prefer to use a single file for the whole movie, e.g. to feed a TV set with integrated DVB receiver from a plugged USB drive, then the MPEG TS (TransportStream) container may be useful instead. Just be aware that the file size may easily exceed the 4 GB limit of FAT32 partitions.

    Back to the kernel, MPEG-2 encoding: The mentioned HCenc is indeed very recommendable as high-quality freeware encoder. The new version 0.28 just upgraded to compatibility with AviSynth 2.6 (required minimum now). Feeding HCenc with the content of an AVI file via a trivial AviSynth script (or even one which does some filtering to e.g. scale the video to DVD/DVB supported resolutions and aspect ratios) is not too hard, some converter GUIs may even help you building one in the background.
    Quote Quote  
  4. Member racer-x's Avatar
    Join Date
    Mar 2003
    Location
    3rd Rock from the Sun
    Search Comp PM
    Got my retirement plans all set. Looks like I only have to work another 5 years after I die........
    Quote Quote  
  5. Pandy,

    Thank you very much for your feedback, and please excuse the vagueness in my original post. I hope I can answer with better precision. Please let me preface that there are holes in my knowledge that may lead me to say some dumb-sounding things. I ask for your understanding in advance. (Should have mentioned this in my original post, sorry about that!)

    For input formats, it is hard to predict exactly what type of files I will receive as an input, because they come from a variety of sources.
    In the past, in addition to properly encoded XVID files, which needed no processing except for some audio level adjustment, I have received swf, OT, and even AVCHD files. Files that needed resizing to the non-standard display size were typically in a standard size, such as 1920 x 1080.
    Fortunately, VirtualDub (with the appropriate codec) has allowed me to read and process most files without issues. From what I can gather, the new playback system prefers MPEG-TS, however it accepts PS as well. XVID was needed for the previous playback system, but is not needed for the new system. Based on the files I have received to date, it is very unlikely that I will get any input files with XVID encoding.

    Regarding the output format, as mentioned above, the new playback system handles both MPEG-PS and TS, although it looks like it does a conversion when it reads in a PS file and simply copies a TS file.

    I was able to get a hold of the file specifications (the format they expect to receive) for another outfit that uses exactly the same playback hardware as I am working with. I think this would be a good target for the output format, as they already have a working system in the field.

    Target output format:
    Codec: MPEG2 Program Stream
    Frame size: 720 x 1280 (they have a nonstandard screen size; they ask you to create the content for the non-standard size and then squeeze it into 720 x 1280, which the playback system then stretches back into the correct full screen size automatically)
    Frame rate: 29.97
    Aspect ratio: 1.2000
    Field order: Upper field first
    Encoding: 8-bits
    Bit rate: 10 Mbps CBR
    Chroma format: 4:2:0
    GOP IBBP size: 15
    Audio: MPEG1 Audio Layer-2
    Sampling Rate: 48000 Hz
    Bit rate: 224 kbps
    Channels: 2
    File extension: *.mpg or *.m2p

    I hope this provides the proper information needed. Thank you very much for reading this long post and any guidance you could provide!
    Quote Quote  
  6. Ok, quite strange requirements but...

    As i've wrote earlier - you may follow regular path and instead coding to XVid do same with HCEnc (simple Avisynth script should be sufficient) or you can give a chance to ffmpeg:

    Code:
    rem --- video filter ---
    
    @rem set vidf=yadif=mode=1,scale="'if(gt(a,6/5),720,-2)':'if(gt(a,6/5),-2,1280)':sws_flags=spline+full_chroma_int+full_chroma_inp:sws_dither=a_dither",pad=720:1280:(ow-iw)/2:(oh-ih)/2:color=black,format=pix_fmts=yuv420p,setdar=ratio=6/5,tinterlace=mode=4,fps=fps=30000/1001
    
    @set vidf=yadif=mode=1,scale=720:1280:sws_flags=spline+full_chroma_int+full_chroma_inp:sws_dither=a_dither,format=pix_fmts=yuv420p,setdar=ratio=6/5,tinterlace=mode=4,fps=fps=30000/1001
    
    @rem --- audio filter ---
    
    @set audf="pan=stereo| FL < FL + 1.414*FC + 0.707*BL + 0.707*SL + 0.177*LFE| FR < FR + 1.414*FC + 0.707*BR + 0.707*SR + 0.177*LFE,compand=0.1|0.1:0.60|0.60:-76/-999|-60/-30|-30/-20|-20/-15|-9.309/-6.0206|0/-3.103:6:-6.0206:-90:0.6,aresample=resampler=soxr:osr=48000:cheby=1:cutoff=0.990:dither_method=triangular_hp,aformat=sample_fmts=fltp:channel_layouts=stereo"
    
    @rem --- MPEG2 Bitrate ---
    
    @set vbitrate=10000
    @set /a vbuffsiz=(%vbitrate%*1500)/3000
    @set /a muxrate=%vbitrate%+384
    @set /a vbtol=(%vbitrate%*10)/200
    
    @rem --- MPEG2 ---
    
    @set mpeg2=mpeg2video -b:v %vbitrate%k -bt:v %vbtol%k -minrate:v %vbitrate%k -maxrate:v %vbitrate%k -bufsize:v %vbuffsiz%k -flags:v +ilme+ildct+cgop -mpv_flags +strict_gop -sc_threshold 1000000000 -alternate_scan 1 -top 1 -g 15 -bf 2 -seq_disp_ext 1
    
    @rem --- MP2 ---
    
    @set mp2=libtwolame -mode stereo -ac 2 -b:a 224k
    
    @rem --- TS ---
    
    @set mpegts=-start_at_zero -shortest -muxrate %muxrate%k -mpegts_original_network_id 15 -mpegts_transport_stream_id 7 -mpegts_service_id 1 -mpegts_pmt_start_pid 256 -mpegts_start_pid 512 -streamid 0:768 -streamid 1:769 -metadata service_provider="Randolphe Prince" -metadata service_name="Feed"
    
    @rem --- file ---
    
    @ffmpeg -i %1 -vf %vidf% -c:v %mpeg2% -af %audf% -c:a %mp2% -f mpegts %mpegts% -y Feed_%1.ts
    Not sure with this strange aspect but there are 2 versions for video filter - unREM one of them.
    to use above you need to create batch file (assumed OS is Windows but Linux batch should be not so different - maybe variable definitions easier to do)
    Last edited by pandy; 15th Jul 2015 at 10:58.
    Quote Quote  
  7. racer-x,
    Thank you very much for the very useful link! And very nice tutorial video!
    I had a look and got some good insight into what needs to be done.

    Thanks again!
    Quote Quote  
  8. LigH.de,

    Thanks very much for your feedback and suggestions!

    I had seen mention of HCenc in internet searches, but was not sure whether it was something I could use. I will give it a try and also compare to ffmpeg, for completeness.

    It looks like the light is visible at the end of the tunnel!

    Thank again!
    Quote Quote  
  9. Pandy,

    Thanks so much for the script!!! It is really, really appreciated!
    I will go through it thoroughly so I can understand what every line does (will take some time for a beginner like me!) .

    Thank you again so, so much!
    Quote Quote  
  10. Originally Posted by Randolphe Prince View Post
    Pandy,

    Thanks so much for the script!!! It is really, really appreciated!
    I will go through it thoroughly so I can understand what every line does (will take some time for a beginner like me!) .

    Thank you again so, so much!
    No problem, glad to help - side to this i completely forgotten to mention about:
    AviUtl and AviDemux - before going for something without UI perhaps it will be more convenient to use one of them - both should support MPEG2 and MPG PS/TS AFAIR
    Quote Quote  



Similar Threads

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