AtiQah-FC / lavfilters

Automatically exported from code.google.com/p/lavfilters
GNU General Public License v2.0
0 stars 0 forks source link

Converting part of flv file #82

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Describe the issue you're having:
Program "AV Video Morpher" can convert choosen part of video file.
But it fails, when converting my flv file.
I tryed to use differend codec packs, that also include lav splitter and other 
splitters.
Does your splitter support AM_SEEKING_CanSeekAbsolute for flv files when 
converting file to wmv or avi?
"AV Video Morpher" converts from begining of flv file.
I have asked developers of "AV Video Morpher". They said, that "one of 
directshow filters does not support AM_SEEKING_CanSeekAbsolute".
Also they said, that they will try to help me.

How can the issue be reproduced? Sample File?
http://depositfiles.com/files/5lu7xhd5b

What version of the product are you using? In which Player?
"AV Video Morpher 3.0.38"

Please provide any additional information below.
Here i have got screenshot of graph. In this graph is not LAV splitter, but 
with LAV splitter graph look same.

Original issue reported on code.google.com by Kozlov.S...@gmail.com on 1 Sep 2011 at 8:24

Attachments:

GoogleCodeExporter commented 9 years ago
LAV Splitter supports AM_SEEKING_CanSeekAbsolute just fine.

The only thing it doesn't support is setting a specific stop time, and thats 
already documented in Issue 71.

Original comment by h.lepp...@gmail.com on 1 Sep 2011 at 8:57

GoogleCodeExporter commented 9 years ago
Does LAV Splitter support specific start time setting?

Also, looking to graph, can you tell my, what filter did not support 
AM_SEEKING_CanSeekAbsolute? Programmers from AVSoft ("AV Video Morpher") said, 
that Avi Mux does not support AM_SEEKING_CanSeekAbsolute. Is it right? If it 
is, then can you tell me please, if you know, how to convert flv to avi part of 
file? I think one should use Avi Mux. Set start and stop time. And then run 
graph. Can you ell me, how can know this?

Thank you.

Original comment by Kozlov.S...@gmail.com on 2 Sep 2011 at 11:30

GoogleCodeExporter commented 9 years ago
LAV Splitter supports all kinds of seeking, setting the start time is required 
for normal seeking as well.

Anyhow, this is not a support forum.

Original comment by h.lepp...@gmail.com on 4 Sep 2011 at 5:14

GoogleCodeExporter commented 9 years ago
LAV splitter and any splitter for flv files do not support correctly audio FPS. 
That causes sound speed problems when converting files. Programmers from AVSoft 
said to me, that they use Directshow Editing Services for flv conversion, but 
splitter filters fail.

Original comment by Kozlov.S...@gmail.com on 5 Sep 2011 at 8:00

GoogleCodeExporter commented 9 years ago
You can see on the picture, that there is no AM_SEEKING_CanSeekAbsolute in 
Graph Studio. I have gigured out, that splitters respond to IMediaSeeking 
interface. I can show the same picture with LAV splitter.
When we request IMediaSeeking during preview it works, but when converting flv 
to avi or wmv strange responce had been received.
Look here:
bool CVideoPlayer::CanMove(void)
{
    HRESULT hr = S_OK;

    DWORD dwCaps = AM_SEEKING_CanSeekAbsolute;

    if ( !m_cpMediaSeeking )
    {
        return false;
    }

    hr = m_cpMediaSeeking->CheckCapabilities(&dwCaps);

#define USE_LOG
#undef USE_LOG

#ifdef USE_LOG
    {
        HANDLE local_file_handle = CreateFileW(L"d:\\VME.log.txt",GENERIC_WRITE,0,NULL,OPEN_ALWAYS,0,0);
        wchar_t local_string_input[] = L"\r\nhr = %d\r\n";
        wchar_t local_string_output[500];
        wsprintfW(local_string_output,local_string_input, (int)hr);
        ULONG local_byte_written = 0;
        SetFilePointer(local_file_handle,0,0,FILE_END);
        WriteFile(local_file_handle,local_string_output,wcslen(local_string_output)*sizeof(wchar_t),&local_byte_written,NULL);
        CloseHandle(local_file_handle);
    }
#endif

    if (hr==S_FALSE)
    {
        if (dwCaps & AM_SEEKING_CanSeekAbsolute)
        {
            // The stream can seek to an absolute position.
            return true;
        }
    }

//  return SUCCEEDED(hr);
    return ( hr == S_OK );
}

Your splitter respond, with hr == S_FALSE and true==(dwCaps & 
AM_SEEKING_CanSeekAbsolute).
This means bug!
We passed only one flag and result is S_FALSE! When we are in preview (without 
muxer and file writer), result is S_OK. If you think, that S_FALSE is right, 
then i have a question: Do you clear not supported flags before returning? If 
you clear, then you answer, that you support this flag. But in documentation 
you shoud answer with S_OK for one flag. But when i assume, that you support 
this flag, when my working for all formats but flv code fails. What do you 
think, what should i think?
When we do this in Directshow Editiong Services also there is no output. I 
think that is because of your splitter, because DEXFILT respond with S_OK with 
this flag, and when starting conversion appears your filter, and we got no 
media samples.

You have got The Big FLV Bug!

Original comment by Kozlov.S...@gmail.com on 17 Oct 2011 at 9:07

GoogleCodeExporter commented 9 years ago
The same situation is with mp4 format. I think, that the problem is with 
FORMAT_MPEG2_VIDEO format type, subtypes for flv 
{31435641-0000-0010-8000-00AA00389B71} and for mp4 
{31637661-0000-0010-8000-00AA00389B71}.

Original comment by Kozlov.S...@gmail.com on 17 Oct 2011 at 10:00

GoogleCodeExporter commented 9 years ago
LAV Splitter functions as expected.
Some other filter in the graph is most likely responsible for the results 
you're seeing. DirectShow will ask every filter for its seeking capabilities, 
not only the source.

Its most likely the muxer which just does not work properly.

Original comment by h.lepp...@gmail.com on 17 Oct 2011 at 10:10

GoogleCodeExporter commented 9 years ago
Muxer and File Writer, and WMV File Writer are Microsofts component. I do not 
belive, that they have problems.
But when i add them, flag in graph studio becomes unchecked.
Also i checked mp4 with FORMAT_MPEG2_VIDEO. It works. While it is unchecked in 
graph Studio, in program graph returns S_OK, and it converts file for mkv.

Original comment by Kozlov.S...@gmail.com on 17 Oct 2011 at 11:01

GoogleCodeExporter commented 9 years ago
How did you checked your splitter?
Did you create program, that converts file from center from my flv to wmv or 
avi?
It is impassable in 1 hour!

Original comment by Kozlov.S...@gmail.com on 18 Oct 2011 at 7:04

GoogleCodeExporter commented 9 years ago
As i said you before, you should modify your code!

I looked in mpc_hc source code and found huge mistake!

I think, that you have got the same mistake in your code!

Look:

Re: How does "ffdshow Video decoder" work with IMediaSeeking?
 by Kozlov Sergey Today at 9:38 am

.You have got a mistake!

// IMediaSeeking

STDMETHODIMP CBaseSplitterFilter::GetCapabilities(DWORD* pCapabilities)
{
return pCapabilities ? *pCapabilities =
AM_SEEKING_CanGetStopPos|
AM_SEEKING_CanGetDuration|
AM_SEEKING_CanSeekAbsolute|
AM_SEEKING_CanSeekForwards|
AM_SEEKING_CanSeekBackwards, S_OK : E_POINTER;
}

STDMETHODIMP CBaseSplitterFilter::CheckCapabilities(DWORD* pCapabilities)
{
CheckPointer(pCapabilities, E_POINTER);
if(*pCapabilities == 0) {
return S_OK;
}
DWORD caps;
GetCapabilities(&caps);
if((caps&*pCapabilities) == 0) {
return E_FAIL;
}
if(caps == *pCapabilities) {
return S_OK;
}
return S_FALSE;
}

You must return S_OK, if we check 1 capability flag!.
Kozlov Sergey

Posts: 14
Join date: 2011-08-23

. Re: How does "ffdshow Video decoder" work with IMediaSeeking?
 by Kozlov Sergey Today at 10:13 am

.You have got a big mistake here:

void CFLVSplitterFilter::NormalSeek(REFERENCE_TIME rt)
{
bool fAudio = !!GetOutputPin(;
bool fVideo = !!GetOutputPin(9);

__int64 pos = m_DataOffset + 1.0 * rt / m_rtDuration * (m_pFile->GetLength() - 
m_DataOffset);

if(!Sync(pos)) {
ASSERT(0);
m_pFile->Seek(m_DataOffset);
return;
}

Tag t;
AudioTag at;
VideoTag vt;

while(ReadTag(t)) {
if(10000i64 * t.TimeStamp >= rt) {
m_pFile->Seek(m_pFile->GetPos() - 15);
break;
}

m_pFile->Seek(m_pFile->GetPos() + t.DataSize);
}

while(m_pFile->GetPos() >= m_DataOffset && (fAudio || fVideo) && ReadTag(t)) {
UINT64 prev = m_pFile->GetPos() - 15 - t.PreviousTagSize - 4;

if(10000i64 * t.TimeStamp <= rt) {
if(t.TagType == 8 && ReadTag(at)) {
fAudio = false;
} else if(t.TagType == 9 && ReadTag(vt) && vt.FrameType == 1) {
fVideo = false;
}
}

m_pFile->Seek(prev);
}

if(fAudio || fVideo) {
ASSERT(0);
m_pFile->Seek(m_DataOffset);
}
}

Wrong line is 
if(!Sync(pos)) {
ASSERT(0);
m_pFile->Seek(m_DataOffset);
return;
}
!

You should select closest Sync position!

How can i set time to be Sync(pos)== true ?

Original comment by Kozlov.S...@gmail.com on 19 Oct 2011 at 8:16

GoogleCodeExporter commented 9 years ago
My code for "CheckCapabilities" is different and behaves properly.
I'm done with this topic, whatever your problem is, its not in my code.

Original comment by h.lepp...@gmail.com on 19 Oct 2011 at 9:23