Roman Shaposhnick | 1 Dec 2004 01:13
Picon

Re: DV frame numbers in AVFrame?

On Sat, Nov 27, 2004 at 06:55:38PM +0100, notnot <at> xs4all.nl wrote:
> Hello,
> 
> I'm playing around with libavformat and libavcodec with the idea of
> writing a DV editing/effects program. I am successful in decoding DV
> frames from file, but I noticed that AVFrame codec_picture_number and
> display_picture_number are not updated for the successive frames, they
> are always 0.
> 
> Is this a bug in the DV decoder?

  I don't know. I don't think any other codec except for mpeg* uses
  it, anyway.

> Is there some other way to retrieve the frame number?

  Why do you need them in the first place ?

Thanks,
Roman.

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
notnot | 1 Dec 2004 02:22
Picon
Picon
Favicon

Re: DV frame numbers in AVFrame?

>> I am successful in decoding DV
>> frames from file, but I noticed that AVFrame codec_picture_number and
>> display_picture_number are not updated for the successive frames, they
>> are always 0.
>>
>> Is this a bug in the DV decoder?
>
>   I don't know. I don't think any other codec except for mpeg* uses
>   it, anyway.
>
>> Is there some other way to retrieve the frame number?
>
>   Why do you need them in the first place ?

Well I just think a frame number is a natural unit to use for indexing
DV data. I can of course do frame number bookkeeping myself, but assumed
that ffmpeg is doing that already.

By the way, AVFrame pts is always 0 when the frame had been decoded by
the dv decoder. The AVPacket where the AVFrame comes from does have a
valid pts. Why is AVFrame pts not set to the corresponding AVPacket pts?

Erwin

Driessens & Verstappen
www.xs4all.nl/~notnot

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
(Continue reading)

notnot | 1 Dec 2004 02:24
Picon
Picon
Favicon

Re: DV frame numbers in AVFrame?

And another question: how do I get a DV frame timecode?

Thanks,
Erwin

Driessens & Verstappen
www.xs4all.nl/~notnot

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
Roman Shaposhnick | 1 Dec 2004 02:41
Picon

Re: DV frame numbers in AVFrame?

On Wed, Dec 01, 2004 at 02:24:01AM +0100, notnot <at> xs4all.nl wrote:
> And another question: how do I get a DV frame timecode?

  You mean From metadata. Which basically opens a really old can of worms
  about what's the best way to represent it in general.

  Now, I don't know how much sense would it make to actually use
  timecode info. for pts and frame counter for dts. Ideas ?

Thanks,
Roman.

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
Roman Shaposhnick | 1 Dec 2004 02:36
Picon

Re: DV frame numbers in AVFrame?

On Wed, Dec 01, 2004 at 02:22:24AM +0100, notnot <at> xs4all.nl wrote:
> >> I am successful in decoding DV
> >> frames from file, but I noticed that AVFrame codec_picture_number and
> >> display_picture_number are not updated for the successive frames, they
> >> are always 0.
> >>
> >> Is this a bug in the DV decoder?
> >
> >   I don't know. I don't think any other codec except for mpeg* uses
> >   it, anyway.
> >
> >> Is there some other way to retrieve the frame number?
> >
> >   Why do you need them in the first place ?
> 
> Well I just think a frame number is a natural unit to use for indexing
> DV data. I can of course do frame number bookkeeping myself, but assumed
> that ffmpeg is doing that already.

  I don't think that *codec* is a valid place to do frame counting. 
  I suspect that mpeg* codecs use these fields because they are inter-frame
  ones, but for DV it makes  much less sense -- its intra.

> By the way, AVFrame pts is always 0 when the frame had been decoded by
> the dv decoder. The AVPacket where the AVFrame comes from does have a
> valid pts. Why is AVFrame pts not set to the corresponding AVPacket pts?

  Same reason.

Thanks,
(Continue reading)

notnot | 1 Dec 2004 03:00
Picon
Picon
Favicon

Re: DV frame numbers in AVFrame?

>> And another question: how do I get a DV frame timecode?
>
>   You mean From metadata. Which basically opens a really old can of worms
>   about what's the best way to represent it in general.
>
>   Now, I don't know how much sense would it make to actually use
>   timecode info. for pts and frame counter for dts. Ideas ?

I'd like to display the DV timecode in HH:MM:SS:FF format, just like a
camcorder does. And it seems useful as a way to index specific frames
on a DV tape.

Erwin

Driessens & Verstappen
www.xs4all.nl/~notnot

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
Roman Shaposhnick | 1 Dec 2004 03:04
Picon

Re: DV frame numbers in AVFrame?

On Wed, Dec 01, 2004 at 03:00:05AM +0100, notnot <at> xs4all.nl wrote:
> >> And another question: how do I get a DV frame timecode?
> >
> >   You mean From metadata. Which basically opens a really old can of worms
> >   about what's the best way to represent it in general.
> >
> >   Now, I don't know how much sense would it make to actually use
> >   timecode info. for pts and frame counter for dts. Ideas ?
> 
> I'd like to display the DV timecode in HH:MM:SS:FF format, just like a
> camcorder does. 

  That's understandable. pts/dts approach will solve this for you,
  however, I'd like to hear other folk's oppinion on that one.

> And it seems useful as a way to index specific frames
> on a DV tape.

  Not really. It jumps all over the place when you work with
  edited footage. 

Thanks,
Roman.

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
(Continue reading)

Michael Niedermayer | 1 Dec 2004 03:44
Picon
Picon

Re: skip frames instead of duplicating?

Hi

On Friday 12 November 2004 08:40, Pantless Ass wrote:
> in ffmpeg.c's do_video_out() we have this code:
>
>     /* duplicates frame if needed */
> for(i=0;i<nb_frames;i++) {
>
> in some cases nb_frames has reached 60, all of which are stored as
> inter frames (in mpeg4's case at least).  these would be better stored
> by skipping the frames in the encoder altogether, if that is
> supported.
>
> at the moment mpeg4_encode_picture_header() just has:
>
> put_bits(&s->pb, 1, 1); /* vop coded */
>
> where it could conceivably be skipping such frames.  a skip-frame hint
> could be passed to the codec from do_video_out(), but i would like to
> know how this should be done before working on it.  how about this:
>
> - add "frame_skipping" and "frame_skipped" to AVCodecContext
> - set frame_skipping to 1 during codec init if the codec supports it
> and it's desired
> - outside and before that for(i=0;i<nb_frames;i++), set enc->frame_skipped
> = 0; - inside that for() and after the call to avcodec_encode_video() set
> enc->frame_skipped = s->frame_skipping; - this way the first copy is coded
> but all subsequent are skipped (if desired)
> - inside mpeg4_encode_picture_header() add if(s->frame_skipped)
> put_bits(&s->pb, 1, 0); return; before put_bits(&s->pb, 1, 1); /* vop
(Continue reading)

Adam Dershowitz | 1 Dec 2004 04:42
Picon
Favicon

Bug in duration and -ss


I have to start by confessing that I have not built ffmpeg, but I am 
using the version that is included with ffmpegX (a Mac GUI wrapped 
around the binary).  As you can see it is 0.4.9-pre1.

It seems that there is a bug in how ffmpeg calculated the length of a 
VOB file.
Here is an example:

  >ffmpeg -i VTS_01_1.VOB test.mov
  ffmpeg version 0.4.9-pre1, build 4731, Copyright (c) 2000-2004 Fabrice 
Bellard
  configuration: --enable-mp3lame --enable-gpl --disable-vhook 
--enable-ffplay --disable-ffserver --enable-a52 --enable-xvid 
--enable-faac --enable-faad --enable-amr_nb --enable-pthreads
  built on Nov 21 2004 19:41:49, gcc: 3.3 20030304 (Apple Computer, Inc. 
build 1666)
  Input #0, mpeg, from 'VTS_01_1.VOB':
  Duration: 00:00:29.5, start: 0.236100, bitrate: 288957 kb/s
  Stream #0.0: Video: mpeg2video, 720x480, 29.97 fps
  Stream #0.1: Audio: ac3, 48000 Hz, stereo, 256 kb/s
  Output #0, mov, to 'test.mov':
  Stream #0.0: Video: mpeg4, 720x480, 29.97 fps, q=2-31, 200 kb/s
  Stream #0.1: Audio: aac, 48000 Hz, stereo, 64 kb/s
  Stream mapping:
  Stream #0.0 -> #0.0
  Stream #0.1 -> #0.1
  Press [q] to stop encoding

  Note that it says that the duration above is 29.5 seconds, when the 
(Continue reading)

Keith Winstein | 1 Dec 2004 12:54
Picon
Favicon

DV question -- want to use dvvideo_decode_frame() directly

Hi all,

I'm trying to write a bare-bones DV decoder around libavcodec, by exporting
dvvideo_init() and dvvideo_decode_frame() and then calling them from my
program on raw, 120000-byte frames from an NTSC DV file.

The DV file plays great with ffmpeg (which of course uses libavformat
and then libavcodec). My understanding is that I should be able to
call dvvideo_decode_frame() with a 120000-byte frame from the DV file
(*without* going through libavformat) and get back the decoded frame.

In practice, I get something weird -- some of the frame looks great,
but most blocks are missing either Y or Cb or Cr.

What am I doing wrong? Do I really need to use libavformat to read a
raw DV file? What kind of input is dvvideo_decode_frame() expecting,
if not a 120000-byte compressed NTSC frame? And why would some of the
decoded frame look fine, but some blocks be missing?

Thanks for any help you can offer,
Keith

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/

Gmane