
Recherche avancée
Autres articles (20)
-
La sauvegarde automatique de canaux SPIP
1er avril 2010, parDans le cadre de la mise en place d’une plateforme ouverte, il est important pour les hébergeurs de pouvoir disposer de sauvegardes assez régulières pour parer à tout problème éventuel.
Pour réaliser cette tâche on se base sur deux plugins SPIP : Saveauto qui permet une sauvegarde régulière de la base de donnée sous la forme d’un dump mysql (utilisable dans phpmyadmin) mes_fichiers_2 qui permet de réaliser une archive au format zip des données importantes du site (les documents, les éléments (...) -
Publier sur MédiaSpip
13 juin 2013Puis-je poster des contenus à partir d’une tablette Ipad ?
Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir -
Submit bugs and patches
13 avril 2011Unfortunately a software is never perfect.
If you think you have found a bug, report it using our ticket system. Please to help us to fix it by providing the following information : the browser you are using, including the exact version as precise an explanation as possible of the problem if possible, the steps taken resulting in the problem a link to the site / page in question
If you think you have solved the bug, fill in a ticket and attach to it a corrective patch.
You may also (...)
Sur d’autres sites (6298)
-
using ASIO to implement interrupt_callback for ffmpeg
22 décembre 2020, par Sergey KolesnikI am trying to properly implement an
interrupt_callback
using ASIO timer foravformat_open_input
,av_read_frame
and possibly for other functions. I can't get it to work when receiving a udp video stream.

I've written a class that waits for periods of time using ASIO timer. Its constructor takes an
io_context
from the thread ofavformat_open_input
execution and an overall timeout period to wait for. By default it waits for 20 ms each time, but can be set to wait longer periods.

class InterruptCallback
{
public:

 constexpr static std::chrono::milliseconds basic_period()
 {
 return std::chrono::milliseconds(20);
 }

 explicit InterruptCallback(asio::io_context &asioContext,
 std::chrono::milliseconds timeout,
 std::chrono::milliseconds period =
 basic_period())
 : waitingPeriod_(period),
 attempts_(timeout / waitingPeriod_),
 timer_(asioContext)
 {
 attempts_ = attempts_ ? attempts_ : 1;
 }

 int wait()
 {
 timer_.expires_after(waitingPeriod_);
 timer_.wait();
 return int(!--attempts_);
 }

 static int wait(void *opaqueCallback)
 {
 auto callback = reinterpret_cast<interruptcallback>(opaqueCallback);
 return callback->wait();
 }

private:
 std::chrono::milliseconds waitingPeriod_;
 size_t attempts_;

 asio::steady_timer timer_;
};
</interruptcallback>


This approach works when no udp stream is being received. Also it returns relatively fast when a udp is being received.


However, when I set a
AVFormatContext::interrupt_callback
I get a lot of errors on decoding.
avformat_find_stream_info
can return fast enough, butAVCodecContext
will be invalid.
Or it can take a very long time to execute.

asio::io_context mainThreadContext{};

 AVFormatContext *pFormatContext = avformat_alloc_context();

 {
 InterruptCallback interruptCallback{mainThreadContext,
 std::chrono::milliseconds(2000)
 };

 pFormatContext->interrupt_callback.callback = &InterruptCallback::wait;
 pFormatContext->interrupt_callback.opaque = &interruptCallback;

 const auto resOpen = avformat_open_input(&pFormatContext,
 containerAddress.c_str(),
 nullptr,
 nullptr);
 if (resOpen < 0)
 {
 std::cerr << "Failed to open stream from: " << containerAddress << std::endl;
 return -1;
 }
 }
 auto avFormatExit = sg::make_scope_exit(
 [&pFormatContext]
 {
 avformat_close_input(&pFormatContext);
 });

 pFormatContext->flags = AVFMT_FLAG_NOBUFFER | AVFMT_FLAG_FLUSH_PACKETS;

 int error = avformat_find_stream_info(pFormatContext, nullptr);



It can happen on the line where I query the stream info, but is also frequent for decoding loop.
These are some of the possible errors :


[h264 @ 00000000027f4000] non-existing PPS 0 referenced
[h264 @ 00000000027f4000] non-existing PPS 0 referenced
[h264 @ 00000000027f4000] decode_slice_header error
[h264 @ 00000000027f4000] no frame!
[mpegts @ 00000000027dea40] PES packet size mismatch
[h264 @ 00000000027f4000] concealing 7217 DC, 7217 AC, 7217 MV errors in I frame
[mpegts @ 00000000027dea40] PES packet size mismatch
[h264 @ 00000000027f4000] concealing 7588 DC, 7588 AC, 7588 MV errors in P frame
[mpegts @ 00000000027dea40] PES packet size mismatch
[h264 @ 00000000027f4000] error while decoding MB 83 5, bytestream -6
[h264 @ 00000000027f4000] concealing 7526 DC, 7526 AC, 7526 MV errors in P frame
[mpegts @ 00000000027dea40] PES packet size mismatch
[h264 @ 00000000027f4000] concealing 7072 DC, 7072 AC, 7072 MV errors in P frame
[mpegts @ 00000000027dea40] PES packet size mismatch
[h264 @ 00000000027f4000] concealing 7651 DC, 7651 AC, 7651 MV errors in P frame
[mpegts @ 00000000027dea40] PES packet size mismatch
[h264 @ 00000000027f4000] concealing 5806 DC, 5806 AC, 5806 MV errors in P frame
[mpegts @ 00000000027dea40] PES packet size mismatch
[h264 @ 00000000027f4000] left block unavailable for requested intra mode
[h264 @ 00000000027f4000] error while decoding MB 0 5, bytestream 8107
[h264 @ 00000000027f4000] concealing 7609 DC, 7609 AC, 7609 MV errors in P frame
[mpegts @ 00000000027dea40] PES packet size mismatch
[h264 @ 00000000051a0040] concealing 6669 DC, 6669 AC, 6669 MV errors in P frame
[mpegts @ 00000000027dea40] PES packet size mismatch
[h264 @ 00000000051a0040] concealing 7254 DC, 7254 AC, 7254 MV errors in P frame
[mpegts @ 00000000027dea40] PES packet size mismatch
[h264 @ 00000000051a0040] concealing 7048 DC, 7048 AC, 7048 MV errors in P frame
[mpegts @ 00000000027dea40] PES packet size mismatch
[h264 @ 00000000051a0040] concealing 7061 DC, 7061 AC, 7061 MV errors in P frame
[mpegts @ 00000000027dea40] PES packet size mismatch
[h264 @ 00000000051a0040] concealing 7220 DC, 7220 AC, 7220 MV errors in P frame
[mpegts @ 00000000027dea40] PES packet size mismatch
[h264 @ 00000000051a0040] concealing 5722 DC, 5722 AC, 5722 MV errors in P frame
[mpegts @ 00000000027dea40] PES packet size mismatch
[h264 @ 00000000051a0040] concealing 7230 DC, 7230 AC, 7230 MV errors in P frame
[mpegts @ 00000000027dea40] PES packet size mismatch
[h264 @ 00000000051a0040] concealing 7085 DC, 7085 AC, 7085 MV errors in P frame
[mpegts @ 00000000027dea40] PES packet size mismatch
[h264 @ 00000000051a0040] concealing 7745 DC, 7745 AC, 7745 MV errors in P frame
[mpegts @ 00000000027dea40] PES packet size mismatch
[h264 @ 00000000051a0040] concealing 6907 DC, 6907 AC, 6907 MV errors in P frame
[mpegts @ 00000000027dea40] PES packet size mismatch
[h264 @ 00000000051a0040] concealing 7301 DC, 7301 AC, 7301 MV errors in P frame
[mpegts @ 00000000027dea40] PES packet size mismatch
[h264 @ 00000000051a0040] concealing 5664 DC, 5664 AC, 5664 MV errors in P frame
[mpegts @ 00000000027dea40] PES packet size mismatch
[h264 @ 00000000051a0040] error while decoding MB 105 8, bytestream -8
[h264 @ 00000000051a0040] concealing 7144 DC, 7144 AC, 7144 MV errors in P frame
[mpegts @ 00000000027dea40] PES packet size mismatch
[h264 @ 00000000051a0040] concealing 7487 DC, 7487 AC, 7487 MV errors in P frame
[mpegts @ 00000000027dea40] PES packet size mismatch
[h264 @ 00000000051a0040] concealing 6912 DC, 6912 AC, 6912 MV errors in P frame
[mpegts @ 00000000027dea40] PES packet size mismatch
[h264 @ 00000000051a0040] error while decoding MB 39 8, bytestream -6
[h264 @ 00000000051a0040] concealing 7210 DC, 7210 AC, 7210 MV errors in P frame
[mpegts @ 00000000027dea40] PES packet size mismatch
[h264 @ 00000000051a0040] concealing 5262 DC, 5262 AC, 5262 MV errors in P frame
[mpegts @ 00000000027dea40] PES packet size mismatch
[h264 @ 00000000051a0040] error while decoding MB 54 8, bytestream -5
[h264 @ 00000000051a0040] concealing 7195 DC, 7195 AC, 7195 MV errors in P frame
[mpegts @ 00000000027dea40] PES packet size mismatch
[h264 @ 00000000051a0040] concealing 7298 DC, 7298 AC, 7298 MV errors in P frame
[mpegts @ 00000000027dea40] PES packet size mismatch
[h264 @ 00000000051a0040] concealing 6819 DC, 6819 AC, 6819 MV errors in P frame
[mpegts @ 00000000027dea40] PES packet size mismatch
[h264 @ 00000000051a0040] concealing 5692 DC, 5692 AC, 5692 MV errors in P frame
[mpegts @ 00000000027dea40] PES packet size mismatch
[h264 @ 00000000051a0040] concealing 6684 DC, 6684 AC, 6684 MV errors in P frame
[mpegts @ 00000000027dea40] PES packet size mismatch
[h264 @ 00000000051a0040] concealing 7600 DC, 7600 AC, 7600 MV errors in P frame
[mpegts @ 00000000027dea40] PES packet size mismatch
[h264 @ 00000000051a0040] concealing 6123 DC, 6123 AC, 6123 MV errors in P frame
[mpegts @ 00000000027dea40] PES packet size mismatch
[h264 @ 00000000051a0040] concealing 7689 DC, 7689 AC, 7689 MV errors in P frame
[mpegts @ 00000000027dea40] PES packet size mismatch
[h264 @ 00000000051a0040] concealing 6846 DC, 6846 AC, 6846 MV errors in P frame
[mpegts @ 00000000027dea40] PES packet size mismatch
[h264 @ 00000000051a0040] left block unavailable for requested intra4x4 mode -1
[h264 @ 00000000051a0040] error while decoding MB 0 10, bytestream 1892
[h264 @ 00000000051a0040] concealing 7009 DC, 7009 AC, 7009 MV errors in P frame
[mpegts @ 00000000027dea40] PES packet size mismatch
[h264 @ 00000000051a0040] concealing 5288 DC, 5288 AC, 5288 MV errors in P frame
[mpegts @ 00000000027dea40] PES packet size mismatch
[h264 @ 00000000051a0040] concealing 7932 DC, 7932 AC, 7932 MV errors in P frame
[mpegts @ 00000000027dea40] PES packet size mismatch
[h264 @ 00000000051a0040] concealing 7039 DC, 7039 AC, 7039 MV errors in P frame
[mpegts @ 00000000027dea40] PES packet size mismatch
[h264 @ 00000000051a0040] error while decoding MB 105 11, bytestream -5
[h264 @ 00000000051a0040] concealing 6784 DC, 6784 AC, 6784 MV errors in P frame
[mpegts @ 00000000027dea40] PES packet size mismatch
[h264 @ 00000000051a0040] concealing 6918 DC, 6918 AC, 6918 MV errors in P frame
[mpegts @ 00000000027dea40] PES packet size mismatch
[h264 @ 00000000051a0040] concealing 6483 DC, 6483 AC, 6483 MV errors in P frame
[h264 @ 00000000051a0040] error while decoding MB 118 1, bytestream -10
[h264 @ 00000000051a0040] concealing 7971 DC, 7971 AC, 7971 MV errors in P frame
[mpegts @ 00000000027dea40] PES packet size mismatch
[h264 @ 00000000051a0040] QP 4294967266 out of range
[h264 @ 00000000051a0040] decode_slice_header error
[h264 @ 00000000051a0040] no frame!
Error sending packet for decoding

Process finished with exit code 1



When I don't set an
interrupt_callback
, no errors occur, stream info is found very quickly.

So, the questions are :


- 

- What am I doing wrong when implementing the interrupt callback ?
- Why don't I get an error when I receive an invalid codec context from
avformat_find_stream_info
?






-
ffmpeg : don't delay printing initial stats
21 décembre 2020, par Gyan Doshi -
Skipping Sequential n Frames Every Selected Time or Frames with FFmpeg [closed]
23 décembre 2020, par ihyyaAHow can i stream video by skipping Specific number of Sequential frames or time every selected number of frames or time.
I searched a lot and could not find the code I was looking for.


I tried codes like this :


ffmpeg.exe -re -i "link.m3u8"-vf select="not(mod(n\, 200))" -acodec aac -c:v libx264 -preset veryfast -strict experimental -f flv "rtmp://.."



But the output is one frame every specific frames or time, but i want selected number of Sequential frames every selected period of time or frames.


I think this Question is not Duplicate


Thanks.