Custom codec. Supported by ffmpeg, incompatible with VLC

*nix specific usage questions
stefano.asioli
New Cone
New Cone
Posts: 4
Joined: 30 Nov 2009 16:09

Custom codec. Supported by ffmpeg, incompatible with VLC

Postby stefano.asioli » 11 Mar 2010 13:05

Hi,

I am trying to add support for a new (custom) codec to VLC under Linux. Currently, it is only
supported by ffmpeg and ffplay. To get this result, I followed these instructions :

http://wiki.multimedia.cx/index.php?tit ... odec_howto

and I modified libavcodec and libavformat. Then, I linked VLC to these modified ffmpeg libraries.
The format is now recognised by VLC, as well as frame size, duration and frame rate. However,
when playing the video, I only see a black screen.

Apparently, libavcodec and libavformat functions like mydecoder_decode_frame and
mydemux_read_packet are correctly called.

Have you got any ideas how I should modify my libavcodec and libavformat to make them fully
compatible with the VLC interface?

Thanks,

Stefano

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: Custom codec. Supported by ffmpeg, incompatible with VLC

Postby Jean-Baptiste Kempf » 11 Mar 2010 14:54

You should add the correct fourcc in modules/codec/avcodec/foucc.c
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

stefano.asioli
New Cone
New Cone
Posts: 4
Joined: 30 Nov 2009 16:09

Re: Custom codec. Supported by ffmpeg, incompatible with VLC

Postby stefano.asioli » 11 Mar 2010 16:18

Hi. Thanks for your reply.

Actually, I already did that. The format is correctly recognised.
As a test, I tried to write a yuv sequence while running both ffplay and vlc, doing something like this
inside mycodec_decode_frame:

Code: Select all

FILE *fake = fopen("fake.yuv","ab"); fwrite(picture->data[0], sizeof(uint8_t), avccontext->width * avccontext->height * 3 / 2, fake); fclose(fake);
Basically, I append a new frame to a file called fake.yuv every time I call mycodec_decode_frame.
Both fake.yuv output files are correct and contain the decoded sequence.

Do you believe it might be a problem of visualisation? Or could it be problem of timestamps?

Thanks,
Stefano

xtophe
Big Cone-huna
Big Cone-huna
Posts: 1209
Joined: 24 Nov 2003 10:12
Location: Bristol, England

Re: Custom codec. Supported by ffmpeg, incompatible with VLC

Postby xtophe » 12 Mar 2010 18:23

Does vlc's log have any interesting messages ?
Xtophe

stefano.asioli
New Cone
New Cone
Posts: 4
Joined: 30 Nov 2009 16:09

Re: Custom codec. Supported by ffmpeg, incompatible with VLC

Postby stefano.asioli » 15 Mar 2010 11:58

Hello.

Not really, however, in the end I found the problem. I had only set dts and pts timestamps in libavformat, while
apparently you also need to set pts in libavcodec. Other codecs that I checked did not require it, as they could
estimate it from the video bit-rate. Hope this will be useful to somebody else in the future.

Thanks,

Stefano


Return to “VLC media player for Linux and friends Troubleshooting”

Who is online

Users browsing this forum: No registered users and 23 guests