ffdec_mpeg4 gets wrong frame rate from rtspsrc

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

ffdec_mpeg4 gets wrong frame rate from rtspsrc

joh-4
Hi~

My application gets the mpeg4 video stream from a AXIS camera and displays it on a x-window. Everything works perfectly. However, I have a problem with recording the video to the file. The problem is that ffdec_mpeg4 gets or sets (not sure who has set)  wrong frame rate. The sdp from rtspsrc said, the frame rate is 30/1 (sdp attribute belonged to a media "a=framerate: 30.0"). However, the source pad of ffdec_mpeg4 has frame rate of 100/1. So, When I record the stream and plays it, it runs approximately three times faster than what it is suppoesed to do.

I think either one of upstream elements, rtspsrc and rtpmp4vdepay, or ffdec_mpeg4 is doing something wrong. Do you guys think it it a bug? What's you think about it?

Thanks,
Justin



------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: ffdec_mpeg4 gets wrong frame rate from rtspsrc

florian iragne-2
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

joh a écrit :

> Hi~
>
> My application gets the mpeg4 video stream from a AXIS camera and
> displays it on a x-window. Everything works perfectly. However, I have a
> problem with recording the video to the file. The problem is that
> ffdec_mpeg4 gets or sets (not sure who has set)  wrong frame rate. The
> sdp from rtspsrc said, the frame rate is 30/1 (sdp attribute belonged to
> a media "a=framerate: 30.0"). However, the source pad of ffdec_mpeg4 has
> frame rate of 100/1. So, When I record the stream and plays it, it runs
> approximately three times faster than what it is suppoesed to do.
>
> I think either one of upstream elements, rtspsrc and rtpmp4vdepay, or
> ffdec_mpeg4 is doing something wrong. Do you guys think it it a bug?
> What's you think about it?

don't know whether it's a bug or not, but you should try to define caps
with a capsfilter element like capsfilter caps="framerate=(fraction)30/1"


Florian
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkpkPVIACgkQO8DE9K7b371s/QCgjgAYW97nD29v1auVhIQ+0XwW
ZqUAoLCRsv8tnRYzzgLLMFoXXGt7jBN2
=Shzy
-----END PGP SIGNATURE-----

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: ffdec_mpeg4 gets wrong frame rate from rtspsrc

joh-4
Thank you for the answer. I've already add the capsfilter to fix the problem, but my app. should support many different types of sources, so I can't hard code the frame rate.

Anyway, the videosink plays well with the decoder caps of framerate=100/1. I think it means videosink does not look at the caps to play the stream, but jpegenc or avimux does look at the framerate for recording.

I've investigated source code, but I coudn't find where the 100/1 came from. The truth is that rtspsrc doesn't even care about "a=framerate..." field to create cap, and it seems like not a mandatory attribute.

Anybody can tell me what how mp4vdepay or ffdec_mpeg4 sets frame rate?

Thank you in advance!

Justin



Is there anybody who can judge that this is a bug or not?


On Mon, Jul 20, 2009 at 2:48 AM, florian iragne <[hidden email]> wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

joh a écrit :
> Hi~
>
> My application gets the mpeg4 video stream from a AXIS camera and
> displays it on a x-window. Everything works perfectly. However, I have a
> problem with recording the video to the file. The problem is that
> ffdec_mpeg4 gets or sets (not sure who has set)  wrong frame rate. The
> sdp from rtspsrc said, the frame rate is 30/1 (sdp attribute belonged to
> a media "a=framerate: 30.0"). However, the source pad of ffdec_mpeg4 has
> frame rate of 100/1. So, When I record the stream and plays it, it runs
> approximately three times faster than what it is suppoesed to do.
>
> I think either one of upstream elements, rtspsrc and rtpmp4vdepay, or
> ffdec_mpeg4 is doing something wrong. Do you guys think it it a bug?
> What's you think about it?

don't know whether it's a bug or not, but you should try to define caps
with a capsfilter element like capsfilter caps="framerate=(fraction)30/1"


Florian
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkpkPVIACgkQO8DE9K7b371s/QCgjgAYW97nD29v1auVhIQ+0XwW
ZqUAoLCRsv8tnRYzzgLLMFoXXGt7jBN2
=Shzy
-----END PGP SIGNATURE-----

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: ffdec_mpeg4 gets wrong frame rate from rtspsrc

Arnout Vandecappelle
On Monday 20 July 2009 18:11:26 joh wrote:
> I've investigated source code, but I coudn't find where the 100/1 came
> from. The truth is that rtspsrc doesn't even care about "a=framerate..."
> field to create cap, and it seems like not a mandatory attribute.
>
> Anybody can tell me what how mp4vdepay or ffdec_mpeg4 sets frame rate?

 I think it's the framerate that is set by the MPEG4 stream itself.  Try
running with --gst-debug=ffmpeg:5 and look for 'Using framerate from codec'.  
If that is there, it means the MPEG4 stream specifies a framerate of 100fps.  
I had something similar with Sony's MPEG4 cameras.  It would surprise me that
Axis does things the wrong way, but it is possible I guess...

 Regards,
 Arnout

--
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  D206 D44B 5155 DF98 550D  3F2A 2213 88AA A1C7 C933

------------------------------------------------------------------------------
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: ffdec_mpeg4 gets wrong frame rate from rtspsrc

joh-4
Hi Amout,

Thank you for your answer!

I've just looked at the debug messages, and found what you mentioned. Below are the part of log.
By the way, can you explain how I can watch the video in normal speed? Does it mean that ffmpeg duplciates frames to satisfy the frame rate what it belives?

Regards,
Justin

-------------------------------------------------------------------------------------------
gstffmpegdec.c:714:gst_ffmpegdec_setcaps:<ffdec_mpeg40> forcing 25/1 framerate

gstffmpegdec.c:744:gst_ffmpegdec_setcaps:<ffdec_mpeg40> Using framerate from codec
.
.
ffmpeg gstffmpegdec.c:1130:gst_ffmpegdec_negotiate:<ffdec_mpeg40> Renegotiating video from 0x0@ -1/-1 fps to 640x480@ -1/0 fps

ffmpeg gstffmpegcodecmap.c:1724:gst_ffmpeg_codectype_to_video_caps: context:0x9c81c00, codec_id:13, encode:0, codec:(nil)

ffmpeg gstffmpegcodecmap.c:186:gst_ff_vid_caps_new: context:0x9c81c00, codec_id:13, mimetype:video/x-raw-yuv

gstffmpegcodecmap.c:1602:gst_ffmpeg_pixfmt_to_caps: caps for pix_fmt=0: video/x-raw-yuv, width=(int)640, height=(int)480, framerate=(fraction)100/1, format=(fourcc)I420
-------------------------------------------------------------------------------------------



On Wed, Jul 22, 2009 at 1:12 AM, Arnout Vandecappelle <[hidden email]> wrote:
On Monday 20 July 2009 18:11:26 joh wrote:
> I've investigated source code, but I coudn't find where the 100/1 came
> from. The truth is that rtspsrc doesn't even care about "a=framerate..."
> field to create cap, and it seems like not a mandatory attribute.
>
> Anybody can tell me what how mp4vdepay or ffdec_mpeg4 sets frame rate?

 I think it's the framerate that is set by the MPEG4 stream itself.  Try
running with --gst-debug=ffmpeg:5 and look for 'Using framerate from codec'.
If that is there, it means the MPEG4 stream specifies a framerate of 100fps.
I had something similar with Sony's MPEG4 cameras.  It would surprise me that
Axis does things the wrong way, but it is possible I guess...

 Regards,
 Arnout

--
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  D206 D44B 5155 DF98 550D  3F2A 2213 88AA A1C7 C933

------------------------------------------------------------------------------
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel


------------------------------------------------------------------------------

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: ffdec_mpeg4 gets wrong frame rate from rtspsrc

Arnout Vandecappelle
On Wednesday 22 July 2009 18:01:56 joh wrote:
> By the way, can you explain how I can watch the video
> in normal speed? Does it mean that ffmpeg duplciates frames to satisfy the
> frame rate what it belives?

 No, as long as you stay within GStreamer, the per-frame timestamps are used
and the framerate doesn't really matter.  It's only when you mux it into a
file again that the framerate is used.  Maybe you're storing it in an AVI
file, that doesn't have per-frame timestamps so when you play it from the
file it uses the 100fps value.

 You could fix the rtspsrc to extract the framerate from the SDP message...

 Regards,
 Arnout


--
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  D206 D44B 5155 DF98 550D  3F2A 2213 88AA A1C7 C933

------------------------------------------------------------------------------
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel