[Ffmpeg-devel] Sony PSP support: problem solved

Lars Blumberg Lars.Blumberg
Tue Apr 11 11:49:55 CEST 2006


No I solved the problem. Maybe anyone has the same problem in future.

To create a PSP compatible with output_example.c you have to make the 
changes I already wrote and to do some additional codec settings for the 
video/audio stream:

additional video settings (probably not necessary, but ffmpeg.exe uses it):

c->qblur = 0.5;
c->rc_buffer_aggressivity = 1.0;
c->sample_aspect_ratio.den = 1;
c->sample_aspect_ratio.num = 1;

additional audio settings (necessary):

c->flags = CODEC_FLAG_GLOBAL_HEADER;
c->time_base.den = c->sample_rate;
c->time_base.den = 1;

Thanks to all who gave help to my former problems.
No I can use the ffmpeg DLLs for all my needs I had.

With best regards

Lars

"Lars Blumberg" <Lars.Blumberg at aquasoft.de> schrieb im Newsbeitrag 
news:e0rkdl$u64$1 at sea.gmane.org...
> Hello newsgroup,
>
> I made a few changes to output_example.c to create a test video for "Sony 
> Play Station Portable" Devices.
> So I had to change the screen size and some compression values (bit rate, 
> sample rate, ...).
>
> Now the problem is, that output_example does not generate a valid audio 
> stream. The audio stream is correctly played with VLC, but the Sony PSP 
> device only plays very strange noises. output_example uses the right 
> codecs for encoding, but there is something wrong with the audio.
>
> Can anyone check my changes, please? I want to know, what I did wrong in 
> order to create a test video for Sony PSP devices.
>
> Here are the differences between the original, current output_example.c 
> and my changes:
>
> --- output_example.c    Sun Apr  2 09:46:56 2006
> +++ output_example_psp.c        Mon Apr  3 16:53:40 2006
> @@ -35,8 +35,9 @@
>
> /* 5 seconds stream duration */
> #define STREAM_DURATION   5.0
> -#define STREAM_FRAME_RATE 25 /* 25 images/s */
> -#define STREAM_NB_FRAMES  ((int)(STREAM_DURATION * STREAM_FRAME_RATE))
> +#define STREAM_FRAME_RATE_DEN 2997 /* 25 images/s */
> +#define STREAM_FRAME_RATE_NUM 100
> +#define STREAM_NB_FRAMES  ((int)(STREAM_DURATION * STREAM_FRAME_RATE_DEN 
> / STREAM_FRAME_RATE_NUM))
> #define STREAM_PIX_FMT PIX_FMT_YUV420P /* default pix_fmt */
>
> /**************************************************************/
> @@ -68,7 +69,7 @@
>
>     /* put sample parameters */
>     c->bit_rate = 64000;
> -    c->sample_rate = 44100;
> +    c->sample_rate = 24000;
>     c->channels = 2;
>     return st;
> }
> @@ -195,16 +196,16 @@
>     c->codec_type = CODEC_TYPE_VIDEO;
>
>     /* put sample parameters */
> -    c->bit_rate = 400000;
> +    c->bit_rate = 480000;
>     /* resolution must be a multiple of two */
> -    c->width = 352;
> -    c->height = 288;
> +    c->width = 320;
> +    c->height = 240;
>     /* time base: this is the fundamental unit of time (in seconds) in 
> terms
>        of which frame timestamps are represented. for fixed-fps content,
>        timebase should be 1/framerate and timestamp increments should be
>        identically 1. */
> -    c->time_base.den = STREAM_FRAME_RATE;
> -    c->time_base.num = 1;
> +    c->time_base.den = STREAM_FRAME_RATE_DEN;
> +    c->time_base.num = STREAM_FRAME_RATE_NUM;
>     c->gop_size = 12; /* emit one intra frame every twelve frames at most 
> */
>     c->pix_fmt = STREAM_PIX_FMT;
>     if (c->codec_id == CODEC_ID_MPEG2VIDEO) {
> @@ -218,7 +219,7 @@
>         c->mb_decision=2;
>     }
>     // some formats want stream headers to be seperate
> -    if(!strcmp(oc->oformat->name, "mp4") || !strcmp(oc->oformat->name, 
> "mov") || !strcmp(oc->oformat->name, "3gp"))
> +    if(!strcmp(oc->oformat->name, "mp4") || !strcmp(oc->oformat->name, 
> "mov") || !strcmp(oc->oformat->name, "3gp") || !strcmp(oc->oformat->name, 
> "psp"))
>         c->flags |= CODEC_FLAG_GLOBAL_HEADER;
>
>     return st;
> @@ -420,7 +421,7 @@
>
>     /* auto detect the output format from the name. default is
>        mpeg. */
> -    fmt = guess_format(NULL, filename, NULL);
> +    fmt = guess_format("psp", NULL, NULL);
>     if (!fmt) {
>         printf("Could not deduce output format from file extension: using 
> MPEG.\n");
>         fmt = guess_format("mpeg", NULL, NULL);
> @@ -438,6 +439,7 @@
>     }
>     oc->oformat = fmt;
>     snprintf(oc->filename, sizeof(oc->filename), "%s", filename);
> +    snprintf(oc->title, sizeof(oc->title), "test video");
>
>     /* add the audio and video streams using the default format codecs
>        and initialize the codecs */
>
> Best regards
>
> Lars 







More information about the ffmpeg-devel mailing list