Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Video Encoding > MPEG-4 AVC / H.264

Reply
 
Thread Tools Search this Thread Display Modes
Old 11th March 2011, 21:07   #1  |  Link
gordonliu
Registered User
 
Join Date: Dec 2006
Posts: 5
What Am I Missing? (H.264 to Xvid... Again)

TL;DR version:

cannot load H264 encoded video file into virtual dub for xvid conversion. Tried all of the solutions that come up with searches on this and most other well known sites with similar content. What do I do?

Long version:

What I am trying to do:

I would like to convert an HD H.264 video to high bitrate HD xvid. I only care about the video.

I do this because my Xbox (old) running XBMC cannot handle H.264 with HD resolution. I routinely use this media center for HD xvid files, but it has never worked with H.264, despite using all of the latest SVNs of XBMC.

Yes. I searched for the answers, on many sites.
I have tried to do this more than once. the Last time, I gave up and installed Xilisoft MKV converter, and used it as a "one click" simple conversion from the source file to a ultra high bitrate Xvid, which I then Reencode using 2-pass with VirtualDub.

Yes. I tried all of the usual settings and techniques recommended to everyone who asks this question.

things I have tried:


1) setting FFdshow VFW decoder settings to "libavcodec"

start-->programs-->FFdshow-->VFW config-->codec-->"libavcodec" from drop down

2) I tried using an AVIsynth script that simply load the file using DirectShowSource (I have no experience with scripts and this was about as far as I got)

3) I tried x264vfw... downloaded, installed... checked the settings in the GUI that it came with (none applicable to my problem), then tried opening my extracted *.h264 (mkvtoolnix) with VirtuaDub (and Vdubmod)... no success...

then I tried going back into VFW config and changed the decoder to "ffmpeg-mt" (which is a new option that appeared after installing x264vfw)... still no success


the steps I have taken, and the results so far


not much... I have split my MKV using MKVToolnix into the audio and video segments (which becomes labeled as "filename.h264").

WHEN USING VIRTUAL DUB... I have no success whatsoever.


Virtual dub gives the following error when I attempt to load the file using various means (including an Avisynth *.avs script)


The File "D:\filename.h264" is of an unknown or unsupported file type



this result (identical error message) happens under all circumstances listed above in 1-3.




I would prefer to use a proper, high quality video encoding application rather than a relatively crappy 1-click program.


Xilisoft's MKV converter has been giving me some headaches with jerky playback and/or significant amounts of dropped or skipped frames. It has a terrible GUI when you attempt anything more difficult than 1 pass encoding.



Background on my system's setup
XP sp3, all codec packs and old codecs have been uninstalled. I used to run CCCP, but I uninstalled it and reset everything back to zero. I have FFDshow, Avisynth, and x264vfw installed... Nothing else whatsoever.

Last edited by gordonliu; 11th March 2011 at 21:10. Reason: added background
gordonliu is offline   Reply With Quote
Old 11th March 2011, 23:49   #2  |  Link
nm
Registered User
 
Join Date: Mar 2005
Location: Finland
Posts: 2,643
Quote:
Originally Posted by gordonliu View Post
Virtual dub gives the following error when I attempt to load the file using various means (including an Avisynth *.avs script)


The File "D:\filename.h264" is of an unknown or unsupported file type


this result (identical error message) happens under all circumstances listed above in 1-3.
Just use the original MKV as a source without demuxing, or mux the .h264 elementary stream to MP4. They will work through AviSynth at least.



Or how about using FFmpeg for the whole process:

Code:
ffmpeg -i input.mkv -acodec copy -vcodec mpeg4 -qscale 3 output.mkv
If Xbox has trouble with the high bitrates that -qscale 3 may give, then use 2-pass encoding with bitrate limits and maybe slower settings.
nm is offline   Reply With Quote
Old 11th March 2011, 23:53   #3  |  Link
J_Darnley
Registered User
 
J_Darnley's Avatar
 
Join Date: May 2006
Posts: 959
Avisynth and ffmpegsource. Also, why didn't DirectShowSource work? You never gave a reason.
__________________
x264 log explained || x264 deblocking how-to
preset -> tune -> user set options -> fast first pass -> profile -> level
Doom10 - Of course it's better, it's one more.
J_Darnley is offline   Reply With Quote
Old 12th March 2011, 07:28   #4  |  Link
gordonliu
Registered User
 
Join Date: Dec 2006
Posts: 5
Quote:
Originally Posted by nm View Post
Just use the original MKV as a source without demuxing, or mux the .h264 elementary stream to MP4. They will work through AviSynth at least.
I tried this.... I tried simply loading my MKV into virtualdub and vdubmod...

both gave me errors, and it was the same error that I have received upon every attempt, regardless of what I have tried.



Quote:
Originally Posted by nm View Post
Or how about using FFmpeg for the whole process:

Code:
ffmpeg -i input.mkv -acodec copy -vcodec mpeg4 -qscale 3 output.mkv
If Xbox has trouble with the high bitrates that -qscale 3 may give, then use 2-pass encoding with bitrate limits and maybe slower settings.

I will try FFmpeg...

I dont think it has anything specific to do with the bitrate. The Xbox just barely manages to render relatively low bitrate MKV files.

higher res HD, with bitrates in the range of 3000-4000 kbps average are impossible.

it freezes almost immediately


it has trouble with anything greater than 720p native, even when the image is downscaled (like setting the box to display 1080i, but playing a 720p file).



it just barely handles 720p xvid content when encoded in the neighborhood of 3500 kbps for the video (average, with 2 pass encoding, not sure about the peak bitrate).


it has no trouble with full 720p or cropped (black bars) with DTS or AC3 at varying bitrates...

but as soon as you throw in the X264/H264, the box just cant handle it.



I realize that I am handicapping myself and jumping through hoops to reduce my picture quality and compression... but I do it for the sake of prevent a need for a massive investment.


my xbox cost $30, and the modchip was $40. I use the stock hard drive (everything is networked).

the Monster brand Component cable (cheapest brand) was $12 on ebay and the small SPDIF optical connector was $5.


thats about $90 for a 720p capable network Media player that can play some games (including emulators), and DVDs.
gordonliu is offline   Reply With Quote
Old 12th March 2011, 07:29   #5  |  Link
gordonliu
Registered User
 
Join Date: Dec 2006
Posts: 5
Quote:
Originally Posted by J_Darnley View Post
Avisynth and ffmpegsource. Also, why didn't DirectShowSource work? You never gave a reason.

I have no idea WHY, but the RESULT was that the error message popped up when I tried to run the AVS script.


I just used the ultra basic, simple command:

DirectShowSource(D:\filename.h264)



I will try that without the muxing, but I seriously doubt it will work.

I will get back tomorrow.
gordonliu is offline   Reply With Quote
Old 12th March 2011, 11:38   #6  |  Link
nm
Registered User
 
Join Date: Mar 2005
Location: Finland
Posts: 2,643
Quote:
Originally Posted by gordonliu View Post
I have no idea WHY, but the RESULT was that the error message popped up when I tried to run the AVS script.

I just used the ultra basic, simple command:

DirectShowSource(D:\filename.h264)
You don't have a splitter that can handle raw H.264 elementary streams.

Quote:
Originally Posted by gordonliu View Post
I will try that without the muxing, but I seriously doubt it will work.
It most definitely will work with MP4 and MKV input if you have the necessary DirectShow splitters installed (i.e. you can play the files with a DShow media player). If there still are problems, try FFmpegSource with MP4 input.


Quote:
Originally Posted by gordonliu
it just barely handles 720p xvid content when encoded in the neighborhood of 3500 kbps for the video (average, with 2 pass encoding, not sure about the peak bitrate).
Ok, then you need to downscale to 720p and limit the bitrate:

Code:
ffmpeg -i input.mkv -acodec copy -vf scale=1280:-1 -b 3500k -maxrate 4500k -bufsize 4500k \
       -mbd rd -flags +mv4+aic -trellis 2 -cmp 2 -subcmp 2 -g 240 -pass 1  output.mkv

ffmpeg -i input.mkv -acodec copy -vf scale=1280:-1 -b 3500k -maxrate 4500k -bufsize 4500k \
       -mbd rd -flags +mv4+aic -trellis 2 -cmp 2 -subcmp 2 -g 240 -pass 2  output.mkv
nm is offline   Reply With Quote
Old 13th March 2011, 19:06   #7  |  Link
ganymede
Registered User
 
Join Date: Aug 2010
Location: Paris
Posts: 52
Quote:
Originally Posted by gordonliu View Post
I just used the ultra basic, simple command:

DirectShowSource(D:\filename.h264)
Didn't you just omit the double-quote marks (") ? It should be DirectShowSource("D:\filename.h264").
ganymede is offline   Reply With Quote
Old 14th March 2011, 00:42   #8  |  Link
Tuik
Registered User
 
Join Date: Apr 2009
Posts: 85
Try Directshowsource("video.mkv", audio=false)

Maybe your directshow codecs won't read the .h264 but the .mkv yes.
Tuik is offline   Reply With Quote
Old 14th March 2011, 07:14   #9  |  Link
gordonliu
Registered User
 
Join Date: Dec 2006
Posts: 5
Quote:
Originally Posted by ganymede View Post
Didn't you just omit the double-quote marks (") ? It should be DirectShowSource("D:\filename.h264").
Quote:
Originally Posted by Tuik View Post
Try Directshowsource("video.mkv", audio=false)

Maybe your directshow codecs won't read the .h264 but the .mkv yes.


Yeah, I seriously doubt i used the correct syntax.


Let me clarify something first:


Im not a dumb ass or a noob. I am a chemistry undergraduate, I have taken programming courses in C, fortran, and Matlab... as well as other computational courses that utilized various programming languages and Unix file structures.


I mention this only to make it clear that I am not a dumb ass when it comes to programming/scripting.



furthermore, I have been doing this sort of low level encoding for many years...


"AFOAF" (if you know what i mean) used to rip VHS skateboard films with his DV camcorder, then encode them and serv them on an Fserv on IRC back around 2000.


again, my point is that I am at least partially familiar with this process.



I wanted to make this clear to ensure that no one thinks I am some ultra "Web 2.0 era" noob, who first began using computers regularly when Myspace was already old, who can only handle GUI based utilities and should therefore avoid this type of process and pay to upgrade his hardware or buy a 1 click program.



Not only that but I actually enjoy manually performing this type of process, which I believe is something common amongst the posters on Doom9, videohelp, and other similar forums.
gordonliu is offline   Reply With Quote
Old 14th March 2011, 07:34   #10  |  Link
gordonliu
Registered User
 
Join Date: Dec 2006
Posts: 5
Quote:
Originally Posted by nm View Post

Ok, then you need to downscale to 720p and limit the bitrate:

Code:
ffmpeg -i input.mkv -acodec copy -vf scale=1280:-1 -b 3500k -maxrate 4500k -bufsize 4500k \
       -mbd rd -flags +mv4+aic -trellis 2 -cmp 2 -subcmp 2 -g 240 -pass 1  output.mkv

ffmpeg -i input.mkv -acodec copy -vf scale=1280:-1 -b 3500k -maxrate 4500k -bufsize 4500k \
       -mbd rd -flags +mv4+aic -trellis 2 -cmp 2 -subcmp 2 -g 240 -pass 2  output.mkv



unfortunately, it doesnt matter.


the xbox (old xbox, not the 360) simply cannot render H.264 of any reasonable quality.


the only successful rendering of H.264 is accomplished with Animated content (like straight up cartoons)...


I can manage ~620x320 (+/-) @ 1000 kbps, with 128 kbps stereo MP3 or stereo AC3.


never any higher bitrate, nor resolution with H.264



Xvid, it can handle 1280x720 (or sometimes with cropped black bars, so about 544 to 680 depending on the original filmed A/R)...


it can handle 720p with bitrates as high as 3500 average, but encoded as 2 pass so that the bitrates obviously spike and dip and I have no idea what bitrates it maxes out with.



with XBMC, which is the most common playback software, there are 2 modes for playback:

"media player" and "Dvd player"


it is my belief, though I may be wrong, that "media player" primarily utilizes the Xbox's CPU (which is something like a 750 mhz pentium 3)...


it is my belief, though I may be wrong, that the "DVD playe" primarily uses the Xbox's GPU, which is significantly more powerful, not only as a graphics rendering system, but also for raw computational power.



I base this off purely qualitative observations made during the course of my experience with this software...


when you launch AVI files or other "computer" file formats (as opposed to VOB files), XBMC defaults to using the "media player"


under these circumstances, the CPU temperatures markedly increase (GPU temps stay static), and the program cannot playback 720p.


when you manually choose to launch these files using the DVD player, playback is normal. the GPU temp markedly increases (the CPU temp also increases but not by nearly as much).




Now, I know it is not as simple as: "this uses one chip, the other uses a different chip"


but there is more of the GPU being utilized under the DVD player option than there is under the Media player option, and that is obvious.





ultimately though, I believe that no one has written the software for H.264, nor does the hardware itself work particularly well with this decoder.
gordonliu is offline   Reply With Quote
Old 14th March 2011, 11:37   #11  |  Link
nm
Registered User
 
Join Date: Mar 2005
Location: Finland
Posts: 2,643
Quote:
Originally Posted by gordonliu View Post
unfortunately, it doesnt matter.


the xbox (old xbox, not the 360) simply cannot render H.264 of any reasonable quality.
My command-lines are for MPEG-4 ASP encoding (same as XviD), not H.264. I suggested FFmpeg because it can handle the whole process without complex external dependencies.

Just try and see how it works!


Quote:
it can handle 720p with bitrates as high as 3500 average, but encoded as 2 pass so that the bitrates obviously spike and dip and I have no idea what bitrates it maxes out with
I gave command lines for 2-pass encoding with 3500 kbps average and 4500 kbps maximum bitrate (with 1-second buffer).


Quote:
it is my belief, though I may be wrong, that "media player" primarily utilizes the Xbox's CPU (which is something like a 750 mhz pentium 3)...

it is my belief, though I may be wrong, that the "DVD playe" primarily uses the Xbox's GPU, which is significantly more powerful, not only as a graphics rendering system, but also for raw computational power.
Well, I haven't looked at the code but I'm pretty sure both players only use CPU for decoding and they use the same FFmpeg/libmpeg2 decoders. Some filtering may be done on the GPU and the players may be configured to do different things to the video.

Quote:
ultimately though, I believe that no one has written the software for H.264, nor does the hardware itself work particularly well with this decoder.
H.264 is much harder to decode than MPEG-4 ASP on a general purpose CPU. Especially with CABAC and in-loop deblocking.
nm is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 20:19.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, vBulletin Solutions, Inc.