On Wed, Apr 28, 2010 at 1:45 PM, Ferenc Deak <[email protected]> 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
>

I got similar task but totally different problems - i loose the audio
:( and the file doubles it's size. If interested my code is at

http://sdr.tera-com.com/tmp/sdrlive_src.tar.bz2

 and I'm much interested in yours
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to