Probably not too much hope, but since there's a few knowledgable people here on the subject...
Well, basically, I'm encoding some video to put on the PSP. However, I'm getting some weird video/audio desynch.
Details of the source video:
- AVI container
- WMV3 video stream (23.976fps)
- MP3 audio stream (VBR)
Basically, after conversion and muxing, the audio and video, at first, are fine, but slowly desynch as you go into the video.
The typical cause for the above is bad framerate, however, this is not the case here (and since AVI doesn't support VFR last time I checked...), interestingly enough.
Okay, firstly, the source video plays back fine. The audio is converted fine (demuxed audio, converted, then muxed with original video stream, and it's fine), so the issue is the video conversion.
I put the video through an AVS script, which is basically a DirectShowSource, and pass it onto x264. Playing the AVS file works fine, which suggests the problem lies in x264. However, I've converted tonnes of videos (primarily H.264/XviD/DivX) fine with x264 - it just seems to be these WMV3 streams causing issues, although x264 should never know? (since it's passed via AVS). (after converting the video and audio streams, I mux it into the PMP container, but that's not the issue, cause it does the exact same thing when muxed into an MP4 container)
Some things I've tried:
- I tried AVISource instead, but the synch was worse?
- Added AssumeFPS(23.976) / ChangeFPS(23.976) / ConvertFPS(23.976) to the AVS file, all to no avail
The resulting frame counts are fine, so the only thing I can think of is some bad frames tripping something up somewhere. So I did a scan for bad frames, of the AVI in VirtualDubMod, but it found none.
Odd.
I'm converting the video with VirtualDubMod, then converting with x264 - this works fine, though two conversions isn't the most convenient, and I'm somewhat stumped as to why I'm getting these dodgey results.
RE: Weird video desynch problem when converting video
From memory, AVI doesn't support VFR, does it? Either case, 23.976 is a fairly standard format, and the fact that the frames and time synch up to the framerate, it seems unlikely to be VFR...
But thanks anyway - you could be right :S
22/06/2008 04:03 AM
squee666
Grand Warlock
Posts: 3,567.1000 Threads: 351
Joined: 4th May 2007
Reputation: 12.17831 E-Pigs: 555.9025
RE: Weird video desynch problem when converting video
ZiNgA BuRgA Wrote:Basically, after conversion and muxing, the audio and video, at first, are fine, but slowly desynch as you go into the video.
The typical cause for the above is bad framerate, however, this is not the case here (and since AVI doesn't support VFR last time I checked...), interestingly enough.
AVI doesn't naturally support VFR, but people have been able to implement VFR into AVI anyway. (I think by sticking null chunks for missing frames.)
It screams VFR or incorrect FR to me. But I have never dealt with VFR material before, so I really have no experience regarding that, and know next to nothing about the characteristics and behavior of VFR material when encoding.
Maybe upload a video sample?
ZiNgA BuRgA Wrote:I put the video through an AVS script, which is basically a DirectShowSource, and pass it onto x264. Playing the AVS file works fine, which suggests the problem lies in x264.
ZiNgA BuRgA Wrote:I'm converting the video with VirtualDubMod, then converting with x264 - this works fine, though two conversions isn't the most convenient, and I'm somewhat stumped as to why I'm getting these dodgey results.
Both these suggest the problem lies with x264. (yeah, repeating what you said...)
ZiNgA BuRgA Wrote:Some things I've tried:
- I tried AVISource instead, but the synch was worse?
- Added AssumeFPS(23.976) / ChangeFPS(23.976) / ConvertFPS(23.976) to the AVS file, all to no avail
As Squee suggested, you can try ffmpegsource. But even if it works, that just dodging the problem.
If it's really VFR, assumeFPS won't fix anything. ChangeFPS and ConvertFPS should maybe? fix the problem, as they try to add, blend or decimate frames to make the video into a constant bitrate. But that's only if the video is recognized properly as VFR in the first place.
Again, no VFR experience here. I've only used change/convertFPS for CFR material before, so don't take what's said above as definite in any case.
22/06/2008 08:39 AM
ZiNgA BuRgA
Smart Alternative
Posts: 17,022.2988 Threads: 1,174
Joined: 19th Jan 2007
Reputation: -1.71391 E-Pigs: 446.1274
RE: Weird video desynch problem when converting video
Finally downloaded and tried the ffmpegSource plugin - still gives desynch
Playing back the AVS, seems that ffmpegSource isn't giving the audio (so I just went ahead with the encode). Tried dubbing the MP3 stream on in the AVS (with DirectShowSource for audio) and seems that they're using different delays (ie, the video/audio is desynched at the beginning) - too lazy to try and synch that up to test the rest, so dropping that...
I did get an interesting message under x264 when doing the encode though (haven't seen it before - outputted by ffmpegsource?), followed by the standard x264 stuff
Quote:[avi @ 03B26DC8]Non interleaved AVI
[avi @ 03B26DC8]Non interleaved AVI
[wmv3 @ 03B0CE30]WMV3 Complex Profile is not fully supported
[wmv3 @ 03B0CE30]WMV3 Complex Profile is not fully supported
avis [info]: 480x272 @ 23.98 fps (33305 frames)
x264 [info]: using cpu capabilities: MMX MMXEXT SSE SSE2 SSE3 3DNow!
encoded frames: 833/33305 (2.5%), 34.62 fps, eta 0:15:37
Either case, screwed up clip - not many AVIs with WMV3 so doesn't really matter I guess.
(This post was last modified: 27/06/2008 04:27 AM by ZiNgA BuRgA.)
RE: Weird video desynch problem when converting video
Didn't see your reply.
Well, if you are still interested, IF the file is VFR:
Make an avs:
Code:
FFmpegSource("location of vid", atrack=-2, timecodes="TIMECODES.TXT", vcache=true, seekmode=-1)
# try seekmode=1 if you want, that's faster, and isn't linear access only, but seekmode=-1 is the "safest".
#Linear access, stick filters here, but no filters here that needs to backtrack or seek, otherwise bad stuff happens
If you aren't going to do any filtering, trimming, and stuff like that, then encode the final directly.
If you do want to use more filtering (that can't be done on previous step), then use the above to encode an intermediate (use high quantizer, or lossless), then write new avs.
Code:
DirectShowSource("location of intermediate", fps=whatever, audio=false)
#or AVISource if your thing is avi
#Stick all your filters and stuff here
Use that to encode final video.
Encode audio separately.
Use MKVMerge on video and audio. Your previous encode/s should have spit out a file called "TIMECODES.TXT". Click on your video track, under general track options, stick in your timecodes, mux.
You should end up with a VFR MKV file.
(This post was last modified: 01/08/2008 10:06 PM by Assassinator.)
01/08/2008 08:07 PM
ZiNgA BuRgA
Smart Alternative
Posts: 17,022.2988 Threads: 1,174
Joined: 19th Jan 2007
Reputation: -1.71391 E-Pigs: 446.1274
RE: Weird video desynch problem when converting video
Thanks for that. From the looks of what you're trying to say, you're copying the timecodes across, rather than converting. Apparently, to convert, all you need to do is:
RE: Weird video desynch problem when converting video
ZiNgA BuRgA Wrote:Thanks for that. From the looks of what you're trying to say, you're copying the timecodes across, rather than converting. Apparently, to convert, all you need to do is: