Manas Bhattacharya | 1 Sep 2008 06:55
Picon

Re: libavformat on a stream

i know that but using http protocol directly is not my aim My aim is to give
the media buffer directly to libavformat without using any present protocols
                                           Manas

On Mon, Sep 1, 2008 at 1:38 AM, Luca Abeni <lucabe72@...> wrote:

> Manas Bhattacharya wrote:
> > Hi all,
> >      i am developing an application which uses libavformat to demux a
> stream
> > .Basically wahat i need to do is store an incoming http progressive
> donwload
> > in a buffer  and input that buffer to libavformat. Do i need to implement
> > new protocol for that ?
>
> libavformat already supports http as an input protocol. Just use
> "http://..." as a file name.
>
>
>                                Luca
> _______________________________________________
> libav-user mailing list
> libav-user@...
> https://lists.mplayerhq.hu/mailman/listinfo/libav-user
>
Vladimir Eremeev | 1 Sep 2008 11:37
Picon

Re: How to make libav to begin write frames having PTS about 0?


Thank you for the answer, however, it's too late.
Thanks to Michel Bardiaux, Luka Abeni, and Michael Conrad, I've found the
solution.

Michael Niedermayer wrote:
> 
> On Wed, Jun 25, 2008 at 05:40:08AM -0700, Vladimir Eremeev wrote:
>> 
>> I am writing an application, capturing a live MPEG2-TS from a dvb-S
>> device
>> and saving its parts to files according to the user-defined schedule.
>> Basically, the main cycle is the following:
> [...]
>> av_write_frame complained about non-monotone time stamps (initially, now
>> I
>> am checking for such situation and change output->streams[]-> cur_dts
>> accordingly ). Some media players also don't like that timestamps.
> 
> if you change internal variables like cur_dts you are on your own and
> should not complain about ANYTHING that might go wrong
> 
> [...]
> 
> -- 
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> 
> While the State exists there can be no freedom; when there is freedom
> there
> will be no State. -- Vladimir Lenin
(Continue reading)

Vladimir Eremeev | 1 Sep 2008 11:50
Picon

Re: how to copy a video file


Please, document, how you create and fill pFormatContextCopie.
You must call av_new_stream as many times as many streams you want to copy
and fill this structure will appropriate information about the streams. This
will assign pFormatContextCopie->nb_streams and fill the array
pFormatContextCopie->streams with correct values.

Then, for each read packet you must change packet.stream_index.
Initially it points to the appropriate value in the pFormatContex->streams
array, but it must point to the appropriate value in
pFormatContextCopie->streams.

Probably, the easiest way would be avoid using libav* and change bytes in
the file.

Nicolas Krieger wrote:
> 
> During a video capture, there is sometimes a crash and the file obtained
> is
> readable, but there is no informations about the length of the video. So,
> I
> want to "repair" the file. What I want to do is to calculate the number of
> frames (I manage to do this) and to put this value in the file. I must
> also
> keep the original file as it is.
> Once I have all the informations (AVFormatContext, AVCodecContext, ...), I
> read the original file :
> 
> while(av_read_frame(pFormatContext, &packet) >= 0) {
> 
(Continue reading)

Vladimir Eremeev | 1 Sep 2008 12:17
Picon

Re: how to copy a video file


Nicolas Krieger wrote:
> 
> Do you think the method I use is the good way to do what I want
> (av_read_frame then av_write_frame) ? If yes, then, there is a bug in my
> programm, but I will keep on this way. 
> 
Yes. 
Good helper to get inside libav* details will be adding some printf's to the
sources to see how it opens files, finds stream info, etc.

Nicolas Krieger wrote:
> 
> I've tried using ffmpeg executable. It does what I want, but a video
> stream
> is destroyed (there are two video streams and one audio stream in the
> original file).
> 

There are plenty of command line options, probably you didn't use all
available ones.
I think, you should learn about -map option.

--

-- 
View this message in context: http://www.nabble.com/how-to-copy-a-video-file-tp19146378p19252183.html
Sent from the libav-users mailing list archive at Nabble.com.
Nicolas Krieger | 1 Sep 2008 13:18
Picon

Re: how to copy a video file

2008/9/1, Vladimir Eremeev <wl2776@...>:
>
>
>
> Nicolas Krieger wrote:
> >
> > Do you think the method I use is the good way to do what I want
> > (av_read_frame then av_write_frame) ? If yes, then, there is a bug in my
> > programm, but I will keep on this way.
> >
>
> Yes.
> Good helper to get inside libav* details will be adding some printf's to
> the
> sources to see how it opens files, finds stream info, etc.
>
>
>
> Nicolas Krieger wrote:
> >
> > I've tried using ffmpeg executable. It does what I want, but a video
> > stream
>
> > is destroyed (there are two video streams and one audio stream in the
> > original file).
> >
>
> There are plenty of command line options, probably you didn't use all
> available ones.
> I think, you should learn about -map option.
(Continue reading)

Guillaume Ferry | 1 Sep 2008 18:31
Picon

WAV 'Decoding'

Hi,

I'm using Fffmpeg in combination with Live555 libraries, in order to decode
some compressed files streamed via RTSP protocol.

It works really great with mp3, but it doesn't for wave files...

Idon't know how to set the encoder properly so it can convert wav input
frames into standard pcm samples...maybe I'm all wrong on this one, since I
do not see well the difference between WAV and PCM (if there's one!)

If it's possible, how can I set a correct CODEC_ID for the decoder.

Here's my error log:

[pcm_s16le <at> 0x80ea280] PCM channels out of bounds

Any help will be greatly appreciated :)

Thanks in advance & Best Regards,

Guillaume.
Stas Oskin | 1 Sep 2008 21:26
Picon
Gravatar

Re: Timing MPEG4 frames for RTP/RTSP

Hi Luca.

>
> This is the SDK you mentioned in your previous email, right?
>  Do not look at when the SDK sends the frames, but look at the frames'
>  timestamps.
>
>  If I understand your description, the problem is that the SDK is
>  providing you with wrong timestamps. Can you check them?

Actually, after you said that, I noticed that SDK does provide me with
timestamps of it's own. Before that I just calculated them by myself
based on system time.

I will check it out - just clarify one thing: in order to keep the
frame similar as possible to the source, I need to re-stream them with
the same period as in the frames coming from SDK?

>
>  Or maybe the problem is that it is using a variable frame rate?
>  In this case, the problem might be in the client, that does not support
>  variable frame rate.

Well, I use VLC for tests which should support variable frame rate.
But FFMPEG is based on static frame rate, isn't so?

> I am pretty sure it is the opposite:
>  (time_of_first_frame + av_rescale_q(pkt.dts, st->time_base, AV_TIME_BASE_Q)) - currenttime
>  :)

(Continue reading)

Luca Abeni | 1 Sep 2008 21:30
Picon
Favicon

Re: WAV 'Decoding'

Hi Guillame,

Guillaume Ferry wrote:
> Hi,
> 
> I'm using Fffmpeg in combination with Live555 libraries, in order to decode
> some compressed files streamed via RTSP protocol.
[...]

Sorry, from your description I did not understand if you are trying to read
a wav file, or to write a wav file.

> Idon't know how to set the encoder properly so it can convert wav input
> frames into standard pcm samples...maybe I'm all wrong on this one, since I
> do not see well the difference between WAV and PCM (if there's one!)

Note that wav is a sort of container which can contain audio compressed with
various codecs (generally, it contains PCM audio, I think).
So, the difference between WAV and PCM is that WAV is a "file format" (or a
container), whereas PCM is an audio codec (simplifying things a little bit,
think about the difference between mov and mpeg4 video).

> If it's possible, how can I set a correct CODEC_ID for the decoder.
> 
> Here's my error log:
> 
> [pcm_s16le <at> 0x80ea280] PCM channels out of bounds

I'm not sure about what you are trying to do, so it's difficult to say
where is the problem... Some time ago, I managed to read .wav files
(Continue reading)

Stas Oskin | 1 Sep 2008 21:42
Picon
Gravatar

Re: Timing MPEG4 frames for RTP/RTSP

Hi.

> note that MP4 is not really a streamable format (when a .mp4 file
>  is streamed, the streamer demuxes it and only sends the audio and
>  video elementary streams).

And if I don't create the MP4 at all - but encode on fly? This means I
don't have any format per se, but just A/V streams.

Are these streams timed by timestamps, or by the set frame rate on
stream opening?

>
> Not sure about what you are asking... It might happen that in some
>  broken files the MP4 headers contain wrong information about the frame
>  rate, but I do not know how frequent/probable this is.
>
>  Another possibility is a file containing video with a variable frame
>  rate (but I do not know if this is supported by mov/mp4).

I meant that ffmpeg suggests timestamps based on set frame rate, but
they can be changed freely?

>
> If the file is not broken, the timestamps must be consistent with the
>  declared frame rate.

And if the source frame rate changes, we have a problem here as we
can't change the sent timestamps to work according to source frames,
because of the fixed frame rate set. Am I correct?
(Continue reading)

Luca Abeni | 1 Sep 2008 21:47
Picon
Favicon

Re: Timing MPEG4 frames for RTP/RTSP

Stas Oskin wrote:
> Hi Luca.
> 
> 
>> This is the SDK you mentioned in your previous email, right?
>>  Do not look at when the SDK sends the frames, but look at the frames'
>>  timestamps.
>>
>>  If I understand your description, the problem is that the SDK is
>>  providing you with wrong timestamps. Can you check them?
> 
> Actually, after you said that, I noticed that SDK does provide me with
> timestamps of it's own. Before that I just calculated them by myself
> based on system time.

Ugh... Don't do that ;-)
Seriously, you cannot use the system time for computing timestamps (the
resulting value will never be completely correct, will be affected by
network jitter, system load, and many other unpredictable factors...)

> I will check it out - just clarify one thing: in order to keep the
> frame similar as possible to the source, I need to re-stream them with
> the same period as in the frames coming from SDK?

What do you mean by "re-stream them with the same period"? Surely, you
have to fill AVPacket with the timestamps values coming from the SDK
(be careful with PTS/DTS differences...). And then you can try to
send out the frames as soon as the SDK provides them.

>>  Or maybe the problem is that it is using a variable frame rate?
(Continue reading)


Gmane