You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello
I have a question. I will be very glad if you help me.
I want to modify pyav to read a new variable from AVPacket. For example, let's assume that I have a variable as an int and let's call it come_5_for_every-packet, and it's equal 5. That means for each packet and frames come_5_for_every-packet must be 5.
I'm working with FFmpeg v4.4. I modified FFmpeg to add in AVPacket struct my new variable (int come_5_for_every-packet). And after that I defined this is equal 5. I built my modified ffmpeg. For test, I wrote a code in c++ and used my ffmpeg. After the command av_read_frame() I printed the value of new variable (cout<come_5_for_every_packet).it works perfectly. Always comes 5 for each packet/frames.
I want my FFmpeg connected to Python. For this purpose I used pyav. So I built pyav with my FFmpeg. Moreover, in Include/avcodec/avcodec.pyx, I added the variable ( int come_5_for_every-packet) to AVPacket. I also defined a new @Property in av/packet.pyx like this: @Property test:
def get(self):
self.packet.ptr.come_5_for_every-packet
Contrary to use of ffmpeg in C++, where come_5_for_every-packet always come, in python(pyav), this variable exists only for two packets. That is, only the first and second packets (for example for 20 frames), this value is equal to five. After the second packet, the value becomes zero (NULL)
I don't know where the problem could be. Why can only the first two packets read this variable and its value, and from the third packet the value becomes zero.
Thank you if you can guide me.
Note: The variable I wrote above was only for example. In fact, the variable that I add to the packet is a 64-bit variable that gives the date and time of each packet. I used come_5_for_every-packet just to make the example easier.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello
I have a question. I will be very glad if you help me.
I want to modify pyav to read a new variable from AVPacket. For example, let's assume that I have a variable as an int and let's call it come_5_for_every-packet, and it's equal 5. That means for each packet and frames come_5_for_every-packet must be 5.
I'm working with FFmpeg v4.4. I modified FFmpeg to add in AVPacket struct my new variable (int come_5_for_every-packet). And after that I defined this is equal 5. I built my modified ffmpeg. For test, I wrote a code in c++ and used my ffmpeg. After the command av_read_frame() I printed the value of new variable (cout<come_5_for_every_packet).it works perfectly. Always comes 5 for each packet/frames.
I want my FFmpeg connected to Python. For this purpose I used pyav. So I built pyav with my FFmpeg. Moreover, in Include/avcodec/avcodec.pyx, I added the variable ( int come_5_for_every-packet) to AVPacket. I also defined a new @Property in av/packet.pyx like this:
@Property test:
def get(self):
self.packet.ptr.come_5_for_every-packet
Contrary to use of ffmpeg in C++, where come_5_for_every-packet always come, in python(pyav), this variable exists only for two packets. That is, only the first and second packets (for example for 20 frames), this value is equal to five. After the second packet, the value becomes zero (NULL)
I don't know where the problem could be. Why can only the first two packets read this variable and its value, and from the third packet the value becomes zero.
Thank you if you can guide me.
Note: The variable I wrote above was only for example. In fact, the variable that I add to the packet is a 64-bit variable that gives the date and time of each packet. I used come_5_for_every-packet just to make the example easier.
Beta Was this translation helpful? Give feedback.
All reactions