Re: [Libav-user] ffmpeg @ 2.0.X has a bogus FFV1 codec?

2013-10-25 Thread André Anjos
After some more investigation and a good debugging session, it seems the
problem comes from the initialisation of the AVFrame rather than the
AVCodecContext (as one may misunderstand from the thread).

To fix the example code, one has to insert 3 lines of code *just after* the
"frame = avcodec_alloc_frame()" call inside "open_video()":

/* new code to make FFV1 codec work well - does not
disturb other codecs, so you can leave it there */
frame->format = c->pix_fmt;
frame->width = c->width;
frame->height = c->height;

If you do this, then the example muxing application will work again.

Could anyone fix the example code in ffmpeg so it reflects these
modifications?

Best, André


On Tue, Oct 22, 2013 at 3:42 PM, André Anjos wrote:

> Another question:
>
> From my investigations, the program aborts at a failed attempt to encode a
> new frame (using avcodec_encode_video2()). If the problem is on the
> initialisation, how can I check the codec is ready before attempting an
> encode?
>
> Thanks, André
>
>
> On Tue, Oct 22, 2013 at 2:49 PM, André Anjos wrote:
>
>> Thanks for this reply. Could you please share a fix for the program that
>> makes it work?
>>
>> André
>>
>>
>> On Tue, Oct 22, 2013 at 10:29 AM, Paul B Mahol  wrote:
>>
>>> On 10/22/13, Andre Anjos  wrote:
>>> > Hello,
>>> >
>>> > I'm using a MacPorts build of ffmpeg 2.0.2. It passes most of our
>>> tests,
>>> > except the one using the FFV1 codec. This seems independent of the file
>>> > format chosen.
>>> >
>>> > How to reproduce the problem:
>>> >
>>> > 1) Download the muxing example from the ffmpeg doxygen documentation (
>>> > http://ffmpeg.org/doxygen/2.0/doc_2examples_2muxing_8c-example.html)
>>> >
>>> > 2) By the end of the application, replace the code:
>>> >
>>> > if (fmt->video_codec != AV_CODEC_ID_NONE) {
>>> > video_st = add_stream(oc, &video_codec, fmt->video_codec);
>>> > }
>>> >
>>> > With:
>>> >
>>> > video_st = add_stream(oc, &video_codec, AV_CODEC_ID_FFV1)
>>> >
>>> > So, that the FFV1 codec is forced.
>>> >
>>> > 3) Compile the program (on OSX, that would be):
>>> >
>>> > clang -I/opt/local/include test.c -L/opt/local/lib -lavutil
>>> > -lavcodec -lavformat -lswscale -lswresample -o ffmpeg_test
>>> >
>>> > 4) Run the program:
>>> >
>>> > ./ffmpeg_test foo.avi
>>> >
>>> > to get:
>>> >
>>> > [libmp3lame @ 0x7fa7d201f200] Channel layout not specified
>>> >  Output #0, avi, to 'test.avi':
>>> >  Stream #0:0: Video: ffv1, yuv420p, 352x288, q=2-31, 400 kb/s, 90k
>>> tbn,
>>> >  25 tbc
>>> >  Stream #0:1: Audio: mp3 (libmp3lame), 44100 Hz, 2 channels, fltp,
>>> 64
>>> >  kb/s
>>> >  Error encoding video frame: Invalid argument
>>> >
>>> > Result: Bogus file, with error
>>> >
>>> > Expected result: clean file with no errors.
>>> >
>>> > Can anyone confirm this or provide some light on what I could possibly
>>> be
>>> > doing wrong? A developer from MacPorts has confirmed the problem - it
>>> does
>>> > not happen on 1.2.x. It does happen with 2.0.1 and 2.0.2 (
>>> > https://trac.macports.org/ticket/40829).
>>> >
>>> > Thanks in advance, A
>>>
>>> FFmpeg 2.0.X does not have bogus FFV1 codec.
>>>
>>> The examples code is of very low quality.
>>>
>>> FFV1 encoder have been changed in its initialization to abort when
>>> width/height is not set.
>>> ___
>>> Libav-user mailing list
>>> Libav-user@ffmpeg.org
>>> http://ffmpeg.org/mailman/listinfo/libav-user
>>>
>>
>>
>>
>> --
>> André Anjos
>> http://andreanjos.org
>>
>
>
>
> --
> André Anjos
> http://andreanjos.org
>



-- 
André Anjos
http://andreanjos.org
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


Re: [Libav-user] ffmpeg 2.0.X has a bogus FFV1 codec?

2013-10-25 Thread Carl Eugen Hoyos
André Anjos  writes:

> Could anyone fix the example code in ffmpeg so 
> it reflects these modifications?

Please send a patch (made with git format-patch) to 
the ffmpeg-devel mailing list.

Please do not top (neither here not there), it is 
considered rude.

Carl Eugen

___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


Re: [Libav-user] ffmpeg 2.0.X has a bogus FFV1 codec?

2013-10-25 Thread André Anjos
Thanks, I will.

Please do not top (neither here not there), it is
> considered rude.


I'm not sure I understand this recommendation. In no sense I meant to top
anyone with my comments.

André
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


Re: [Libav-user] ffmpeg 2.0.X has a bogus FFV1 codec?

2013-10-25 Thread Carl Eugen Hoyos
André Anjos  writes:

> Please do not top (neither here not there), it is
> considered rude.

Please do not top-post on all ffmpeg mailing lists.

Sorry, Carl Eugen

___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


[Libav-user] what's the extradata should be when using ffmpeg+libstagefright?

2013-10-25 Thread ahqzy
Hi all,
   To using hardware decoding, I compiled ffmpeg(0.10) with andorid 
libstagefright successfully. When I call it,  in the 
Stagefright_init(AVCodecContext *avctx), the extradata must be specified as 
below in the source:


static av_cold int Stagefright_init(AVCodecContext *avctx)
{
……
……
if (!avctx->extradata || !avctx->extradata_size || avctx->extradata[0] != 1)
return -1;
……
}
I dont't konw how to fill the avctx->extradata, anyone can help me?

___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


Re: [Libav-user] Problem Generating B-Frames Using libavcodec/libx264

2013-10-25 Thread Robert Schmidt
> i have your same goal, also I am writing a an application that encodes
> incoming video in H.264 using libavcodec and libx264. I don't know the
> solution for yuor problem, because i do not know how to encode.
> i have a avi or mp4 file as input. The *avcodec_encode_video2* function
> takes input raw video data from frame, so i demux my file and i obtain a
> raw video file; now i want encode it, so how i can open the raw file, read
> the raw frames and encode them into h264?? Is this the right wat yo encode
> in H.264? There are other solutions?? How do you encode?? Can you help me,
> please??

Hi Francesco,

I'm not entirely certain what you are looking for, but for I basically
do the following for my transcoding test utility:

  * Read a raw packet from the input file using av_read_frame (demux)
  * Decode the packet into a frame using avcodec_decode_video2 (decode)
  * Encode the frame using avcodec_encode_video2 (encode)
  * Write the resulting packets using av_interleaved_write_frame (mux)

I found the examples at http://ffmpeg.org/doxygen/trunk/examples.html
helpful for understanding how to properly use the API calls.  Also, if
you look up the relevant API calls in the FFmpeg Doxygen documenation
(http://ffmpeg.org/doxygen/trunk/index.html), there are
cross-references to where they are used in the examples that help
provide context and show how they're used.

If you want to use H.264 for encoding, you can specify "h264" as the
format if you call avformat_alloc_output_context2 to set up your
output muxer or use AV_CODEC_ID_H264 when a setting up your encoder.

My application receives its video data from a separate source, so I
have to manually set up the AVFrame structures to pass to the encoder
rather than rely on av_read_frame/avcodec_decode_video2, but otherwise
the process is basically the same.

I hope this helps.

Rob
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


Re: [Libav-user] Criteria for h.264 key-frame detection

2013-10-25 Thread Paul B Mahol
On 10/20/13, Robert Krueger  wrote:
> Hi,
>
> I have AVCHD files from a camera (Panasonic Lumix GH1) that demux and
> decode with libavformat/libavcodec detecting no other keyframe but the
> first (both, the first video packet and video frame are marked as
> keyframe), which is not what I would have expected for those clips as
> the GOP structure of files produced by this camera is known to be
> different.
>
> My question is now, what libavcodec/libavformat uses as criteria to
> decide whether a packet is a keyframe packet or a frame is a keyframe
> in this case. Does it only trigger in the case of IDRs or are recovery
> point SEIs also detected? Should I open a trac issue for this with a
> sample?

AFAIK h264 key frame detection is in parser. And only in two places in
code is key_frame set to 1.

If key frame detection is wrong for certain file that it could be bug.
Without sample it is impossible to find out.

I would recommend to open trac issue.

>
> My requirement is, I want to find points in the stream suitable for
> random access using libavformat/libavcodec. What are my options for
> this kind of files?
>
> Thanks,
>
> Robert
> ___
> Libav-user mailing list
> Libav-user@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user
>
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


Re: [Libav-user] Criteria for h.264 key-frame detection

2013-10-25 Thread Robert Krüger
On Fri, Oct 25, 2013 at 5:59 PM, Paul B Mahol  wrote:
> On 10/20/13, Robert Krueger  wrote:
>> Hi,
>>
>> I have AVCHD files from a camera (Panasonic Lumix GH1) that demux and
>> decode with libavformat/libavcodec detecting no other keyframe but the
>> first (both, the first video packet and video frame are marked as
>> keyframe), which is not what I would have expected for those clips as
>> the GOP structure of files produced by this camera is known to be
>> different.
>>
>> My question is now, what libavcodec/libavformat uses as criteria to
>> decide whether a packet is a keyframe packet or a frame is a keyframe
>> in this case. Does it only trigger in the case of IDRs or are recovery
>> point SEIs also detected? Should I open a trac issue for this with a
>> sample?
>
> AFAIK h264 key frame detection is in parser. And only in two places in
> code is key_frame set to 1.
>
> If key frame detection is wrong for certain file that it could be bug.
> Without sample it is impossible to find out.
>
> I would recommend to open trac issue.

http://trac.ffmpeg.org/ticket/3083

Carl, could you attach the samples I uploaded?
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


[Libav-user] A/V synchronization for an emulator movie recording feature

2013-10-25 Thread Ulf Magnusson
Hello,

I'm adding a movie recording feature to an emulator I'm working on. I
have the video part working, but since I'm new to movie encoding I'm
unsure what the best practices are when it comes to audio/video
synchronization. I'm aware of these two approaches:

(1) Set PTS values on video and/or audio packets before writing them
with av_interleaved_write_frame().
(2) Stretch/shrink audio to maintain A/V synchronization.

Perhaps (1) should be done even if (2) is done, but I'm not sure how
these two approaches would interact. I've also heard that some
formats/players don't support PTS values for audio frames.

Any recommendations? Latency would not be an issue since you wouldn't
view the movie while playing. I'd prefer for the video to be as smooth
as possible, without jerky motion when scrolling.

The current WIP without audio is at
https://github.com/ulfalizer/nesalizer/blob/movie-wip/movie.cpp (I
based it on libavformat/output-example.c). I'd probably have an
add_audio_frame() function to go with add_video_frame().

Thanks,
Ulf
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user