Hi Eveengy? Pereguda?  Could you sign so we know how to address you thanks.

As for the problems you have, I'm not an ffmpeg expert so will only be
able to provide general suggestions.  I have just tried running two
videos in parallel with osgmovie -e ffmpeg movieone.ogg movetwo.avi
and it runs both together fine.  I'm using OSG svn/trunk.  What
version of the OSG and ffmpeg are you using?

Robert.

On 25 February 2013 05:43, Evgeny Pereguda <[email protected]> wrote:
> Hi everyone,
> I have got some troubles with ffmpeg plug-in.
> I found, that it can play video file only one time. After finishing file, the 
> second playing starting without sound and after 1 second has become frozen.
>
> I found that the next code in plug-in processes the finishing of stream of 
> packets:
>
>         // Read the next frame packet
>         if (av_read_frame(m_format_context.get(), &packet) < 0)
>         {
>             if (url_ferror(m_format_context->pb) == 0)
>                 end_of_stream = true;
>             else
>                 throw std::runtime_error("av_read_frame() failed");
>         }
>
>         if (end_of_stream)
>         {
>             // If we reach the end of the stream, change the decoder state
>             if (loop())
>             {
>                 m_clocks.reset(m_start);
>                 rewindButDontFlushQueues();
>             }
>             else
>                 m_state = END_OF_STREAM;
>
>             return false;
>         }
>
> As a result, video either is looped or is stopped as stream. However, the 
> state END_OF_STREAM in class FFmpegDecoderAudio interrupts computing present 
> time and interrupts synchronization between audio and video streams
>
>         if (m_packet.type == FFmpegPacket::PACKET_DATA)
>         {
>             if (m_packet.packet.pts != int64_t(AV_NOPTS_VALUE))
>             {
>                 const double pts = av_q2d(m_stream->time_base) * 
> m_packet.packet.pts;
>                 m_clocks.audioSetBufferEndPts(pts);
>             }
>
>             m_bytes_remaining = m_packet.packet.size;
>             m_packet_data = m_packet.packet.data;
>         }
>         else if (m_packet.type == FFmpegPacket::PACKET_END_OF_STREAM)
>         {
>             m_end_of_stream = true;
>         }
>         else if (m_packet.type == FFmpegPacket::PACKET_FLUSH)
>         {
>             avcodec_flush_buffers(m_context);
>         }
>
>         // just output silence when we reached the end of stream
>         if (m_end_of_stream)
>         {
>             memset(buffer, 0, size);
>             return size;
>         }
>
> More over, class FFmpegImageStream does not have any callback function for 
> the catching of the moment finishing of file. It means that the branch of 
> _status == PLAYING is still when video stream is finished
>
>                 // Обработка команд управления
> while (! done)
> {
>                         // Обработка условия воспроизведения
>             if (_status == PLAYING)
>             {
>
>
> I create one decision of these problems:
>
> if (loop())
>  {
>                                 // Если воспроизведение зацикленно, то 
> повторить цикл
> m_clocks.reset(m_start);
> rewindButDontFlushQueues();
>
> m_stop = false;
> }
> else
> {
>
> if(m_device)
> m_state = END_OF_STREAM; // Если источник сигнала видеоустройство
> else
> {
>
> FFmpegImageStream * const this_ = 
> reinterpret_cast<FFmpegImageStream*>(m_imageStream);
>
> f(this_)
> {
> this_->microSleep(3000000);
>
> this_->rewind();
>
> this_->pause();
> }
>
> }
>
> }
>
> Where m_device is a bool switch which has state true for live cam and false 
> for local file. For the second state FFmpegImageStream has been gotten and 
> after stopping process on 3 second the stream is rewind and state to pause. 
> The video file can be played repeatedly.
> I know that this trick looks ugly and wait any another idea.
>
> With best regards.
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=52854#52854
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to