ciorba andrei | 28 Jul 09:43 2014

Appending frames to a video file

Hello,
 I'm trying to open an existing video file and then add more frames to it. The newly added frames will have the same dimensions as the existing video and the same pixel format.
I've also considered creating a new video with the new frames and then joining the two videos into one.
I've looked into the concat protocol, but from what I saw you can't concatenate two videos "in place" by only adding the second video to the first one without creating the 3rd video. 
Is there any way I could add more frames to an existing video(either using the API provided by the ffmpeg libraries or by using the console applications) or concatenate two videos without having to copy both files to a 3rd one?

Any help would be appreciated.
Thanks!
Andrei.


_______________________________________________
Libav-user mailing list
Libav-user@...
http://ffmpeg.org/mailman/listinfo/libav-user
Xiemin Chen | 28 Jul 16:41 2014
Picon

ffmpeg libstagefright init error: Malformed AVC codec specific data

hi, all... I try to use hw decoder by libstagefright with Android but so many mistakes frustrate me. I play ipcam rtsp stream with ffmpeg and I refer to the following tutorial:
It will check extradata[0] first as following, but the extradata[0] for ipcam rtsp stream is 0 instead of 1. If I commit the "if statement", OMXCodec tells me the error message "Malformed AVC codec specific data." when I call OMXCodec::Create().
    if (mVideoTrack->extradata[0] == 1) {
        mFormat->setData(kKeyAVCC, kTypeAVCC, mVideoTrack->extradata, mVideoTrack->extradata_size);
    }
As far as I know that the extradata will store the sprop-parameter-sets comes from sdp protocol. But I don't know why it checks the extradata[0] and whether it's necessary. Can you please give me any instruction? Thanks.
_______________________________________________
Libav-user mailing list
Libav-user@...
http://ffmpeg.org/mailman/listinfo/libav-user

AAC decoding delay/take 2

Hi there, 

I already posted that a couple of weeks ago but I didn’t get a reply.
I thought I’d try my luck again.

I am currently working on my own video player.
I just tried it with a bunch of files and I found out that the audio is always about one frame after the video whenever the video contains AAC audio.
I tried a bunch of test files with various video codecs (mostly Pro Res and H.264), resolutions etc … whenever AAC audio is present, the audio is delayed.
The test files have all been in the QuickTime container.

To verify, I created two test files from the same Final Cut project. One Pro Res with PCM audio and one H.264 with AAC audio.
While decoding, I wrote the raw decoded samples to a file and checked them in Audacity. Technically, they should be equal.
See the attached screenshot.

The upper track is perfectly equal to the source audio track.
The bottom audio track is the captured AAC output. 

As you can see, the AAC output is more than 2000 samples delayed.

Can anyone explain where this delay is coming from?




Best regards!

Flo
_______________________________________________
Libav-user mailing list
Libav-user@...
http://ffmpeg.org/mailman/listinfo/libav-user
Ryan Grewatz | 26 Jul 00:09 2014
Picon

avformat_open_input: adding a timeout

Hello,

I'm currently writing a video streaming app that uses the ffmpeg libraries. I'm dealing with a situation where I'm preparing an instance of AVFormatContext by calling avformat_open_input. I'm using this over a network under RTSP and I need to handle cases where a connection cannot be established. I figured the best way to go about this is to add a connection timeout of around 5-10 seconds, but I just can't seem to figure out how to get this idea to work. Any help is greatly appreciated.

code:
    if(avformat_open_input(&formatCtx, "rtsp://192.168.0.100/1", NULL, NULL)!=0){
        LOGI(".100 not working... trying .101");
        formatCtx = NULL;
        if(avformat_open_input(&formatCtx, "rtsp://192.168.0.101/1", NULL, NULL)!=0)
            return -1; // Couldn't open file


Thanks!

--

Ryan
_______________________________________________
Libav-user mailing list
Libav-user@...
http://ffmpeg.org/mailman/listinfo/libav-user
Ryan Grewatz | 26 Jul 00:07 2014
Picon

avformat_open_input: adding a timeout

Hello,

I'm currently writing a video streaming app that uses the ffmpeg libraries. I'm dealing with a situation where I'm preparing an instance of AVFormatContext by calling avformat_open_input. I'm using this over a network under RTSP and I need to handle cases where a connection cannot be established. I figured the best way to go about this is to add a connection timeout of around 5-10 seconds, but I just can't seem to figure out how to get this idea to work. Any help is greatly appreciated.

code:
    if(avformat_open_input(&formatCtx, "rtsp://192.168.0.100/1", NULL, NULL)!=0){
        LOGI(".100 not working... trying .101");
        formatCtx = NULL;
        if(avformat_open_input(&formatCtx, "rtsp://192.168.0.101/1", NULL, NULL)!=0)
            return -1; // Couldn't open file


Thanks!

--

Ryan
_______________________________________________
Libav-user mailing list
Libav-user@...
http://ffmpeg.org/mailman/listinfo/libav-user
Matt Orlando | 25 Jul 17:27 2014
Picon

ffmpeg on iOS

Hi folks,

I'm trying to make an iOS build of our game using the FFmpeg libraries acquired from here.  After many linker error fixes, I'm down to what appears to be the final problem.  What makes this difficult is that I made a library that depends on the libav libraries...so I think I encountered a lot of issues with a library depending on another library.  Now it seems like the libav libraries are depending on yet another library (bz2?), but I'm unsure.  Here's the error...



Does anyone have any ideas?

Thanks
-Matt
_______________________________________________
Libav-user mailing list
Libav-user@...
http://ffmpeg.org/mailman/listinfo/libav-user
volich | 24 Jul 08:18 2014
Picon

Re: [libav-user] queuing of avframe

Sorry for formating, it was first message.

Hi

I want to realise AVFrames handling with queue.
My code is

int decode(AVCodecContext *codec_ctx, AVPacket *packet)
{
  AVFrame *frame = av_frame_alloc();
  if (!frame)
    return -1;

  int got_frame;
  int ret = avcodec_decode_video2(codec_ctx, frame, &got_frame, packet);
  if (ret >= 0 && got_frame) {
    /* Allocate buffer references */
    for (int i = 0; i < 3; i++) {
      uint8_t *data = frame->data[i];
      int size = frame->linesize[i] * frame->height;
      frame->buf[i] = av_buffer_create(data, size, av_buffer_default_free, NULL, 0);
    }

    enqueue(frame);
    return 0;
  }

  av_frame_free(&frame);
    return -1;
}

void someFunc()
{
  AVFrame *frame = dequeue();

  ...

  if (frame)
    av_frame_free(&frame);
}

Is it right?

Regards,
Yuriy
volich | 24 Jul 08:01 2014
Picon

Queuing of AVFrame

Hi

I want to realise AVFrames handling with queue.
My code is

int decode(AVCodecContext *codec_ctx, AVPacket *packet)
{
           AVFrame *frame = av_frame_alloc();
if (!frame) return -1;

int got_frame; int ret = avcodec_decode_video2(codec_ctx, frame, &got_frame, packet); if (ret >= 0 && got_frame) {
/* Allocate buffer references */ for (int i = 0; i < 3; i++) { uint8_t *data = frame->data[i]; int size = frame->linesize[i] * frame->height; frame->buf[i] = av_buffer_create(data, size, av_buffer_default_free, NULL, 0); } enqueue(frame); return 0; }
av_frame_free(&frame); return -1;}

void someFunc()
{
           AVFrame *frame = dequeue();

....
if (frame) av_frame_free(&frame); }

Is it right?

Regards,
Yuriy

_______________________________________________
Libav-user mailing list
Libav-user@...
http://ffmpeg.org/mailman/listinfo/libav-user
Anthony Clark | 24 Jul 04:07 2014
Picon

RTP woes

Hey all,

The RTP libraries in FFMPEG aren't documented or really even used in many opensource projects I could find. My main questions are:

1) the RTP implementation only seems to support one (1) stream. Does this mean extra work has to be done one the receiver to coordinate the streams when using the SDP as input? As in, how do A/V steams get synchronized if the streams are delivered completely separately (ie - not muxed).

2) I'm interested in have a RAW binary data steam possibly implemented as an extension/part of FFMPEG. Where do I start for looking into creating my own encoder/decoder/muxer/demuxer/plugin?

3) Follow up to question 1, would muxing everything into an MPEGTS file be 'easier' to manage a central delivery mechanism?

Thanks all, I'm just a little overwhelmed with how large the API is and how little documentation there is. Most of the API is self explanatory, but it seems there are conventions I can't find the source of. 

Thanks!
Anthony C.

_______________________________________________
Libav-user mailing list
Libav-user@...
http://ffmpeg.org/mailman/listinfo/libav-user
Matt Orlando | 23 Jul 23:06 2014
Picon

H.264 Looping

Hi everyone,

I need to implement a means of looping some h.264 videos.  I'll copy my current implementation here for my update so you can see how it's currently working.  I use Unity so this code resides in a native plug-in that I turn into a DLL.  My C# scripts track the current frame they've acquired since multiple streams run in conjunction with each other to form a single "asset".  For any looping clips, I'd like to reset the desired frame to 0 and have the DLL start streaming again from the beginning.

If anyone can help point me in the right direction for handling this, that'd be amazing.  I'm sure there are simple ways I could go that'd basically re-open the streams; however, I need to make sure there's no hiccup of course.

Here's the update code:

bool H264Stream::Update(int desiredFrame)
{
if( desiredFrame <= m_FrameRead )
return true;
int frameFinished = 0;
if( av_read_frame( m_AVFormat, &m_Packet ) >= 0 )
{
if( m_Packet.stream_index == m_AVStream->index )
{
avcodec_decode_video2( m_AVContext, m_AVFrame, &frameFinished, &m_Packet );
if( frameFinished != 0 )
{
sws_scale( m_SwsContext, m_AVFrame->data, m_AVFrame->linesize, 0, m_AVContext->height, m_Picture->data, m_Picture->linesize );
m_FrameRead++;
av_free_packet( &m_Packet );
}
}
else
{
av_free_packet( &m_Packet );
}
}
else if( !m_Completed )
{
m_Packet.data = NULL;
m_Packet.size = 0;
avcodec_decode_video2( m_AVContext, m_AVFrame, &frameFinished, &m_Packet );
if( frameFinished != 0 )
{
sws_scale( m_SwsContext, m_AVFrame->data, m_AVFrame->linesize, 0, m_AVContext->height, m_Picture->data, m_Picture->linesize );
m_FrameRead++;
}
else
{
m_Completed = true;
av_free_packet( &m_Packet );
}
}
return m_FrameRead >= desiredFrame;
}


Thanks for the help!
-Matt 
_______________________________________________
Libav-user mailing list
Libav-user@...
http://ffmpeg.org/mailman/listinfo/libav-user
Carl Eugen Hoyos | 23 Jul 12:49 2014
Picon

Re: MOV/MP4 format not playing in Windows Media Player (but does play in ffplay, vlc, ...)

Robin Stevens <rdstevens <at> ...> writes:

> The MP4 file is produced, and works just fine in 
> ffplay or vlc, but won't play in windows media player.

Did you test with ffmpeg (the application)?

Carl Eugen

Gmane