Hi again...

After doing some research, I came to the conclusion that the thing to blame for this strange "feature" is the following line (coming up in the output of libavformat):

[mp4 @ 0x80b440]Codec for stream 1 does not use global headers but container format requires global headers

Anyone has any knowledge/documentation/tips on how to use the global headers correctly?

Obviously the way I'm (trying to) using them is not correct:

    case CODEC_TYPE_VIDEO:
        if (output_format_context->oformat->flags & AVFMT_GLOBALHEADER)
        {
            output_codec_context->flags |= CODEC_FLAG_GLOBAL_HEADER;
        }

Thanks,
Ferenc


On 04/28/2010 12:45 PM, Ferenc Deak wrote:
Hi all,

I have the following situation here: I need to implement a small tool which cuts the first X (10 or 20, 30, ...) seconds out of a movie clip, and writes the result in a new file.

What I do is very similar to the initialization/opening phase from ffplay.c:

1. Open the file (av_open_input_file, av_find_stream_info)
2. Seek to the required position (avformat_seek_file)
3. Setup the codecs (including check for global headers
4. Create an output context (AVFormatContext based on AVOutputFormat)
5. Open the output file (url_fopen)
6. Write the output header
7. loop starts: read a packet from the input file (av_read_frame)
8. modify the packet's time to be zero based (PTS, DTS)
9. write the packet to the output
10. go to 7 if we have more packets to read
11. write_trailer, close the files.
12. done

Now, here comes the problem. It has a small "bug" (probably in the logic) : after the app runs and "cuts" the file it seems that the players don't see the video stream anymore, so they display the first video frame and after this only the audio is being played. I have included a small logger, and if I run my cutter application once more, it sees only the audio frames... In ffplay I open the file and it plays the audio nicely, the first video frame is frozen on the screen, but if I click somewhere on the ffplay window (meaning: seek) it seeks there, starts playing the video only. NO audio frames are there anymore ... Step 8 is not responsible for this stupid behavior, it behaves the same way if it's there or not.

Have you ever seen this behavior? Had anyone of you implemented this cut out feature?

Thanks
Ferenc

_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to