Replies: 16 comments
-
Maybe we have the similar problem |
Beta Was this translation helpful? Give feedback.
-
I think I have found the root cause. This is due to I muxed a packet (av.packet.Packet) twice (in other places). |
Beta Was this translation helpful? Give feedback.
-
I've not dug deep into that part for a while, and my memory of it is quite bad, but I'm surprised that muxing the same packet twice would be problematic in general. I can see having shallow and deep copies on packets being useful (the difference being if it copies the underlying buffer). I agree that the PTS handling is not ideal. The FFmpeg binary has a few different modes for automatically dealing with PTSes, but it is in the binary, not the library. If (and only if) your streams are completely consistent you can set the PTS to |
Beta Was this translation helpful? Give feedback.
-
Now I solved this issue by doing deep copy of a packet through the update_buffer API. Thanks very much. |
Beta Was this translation helpful? Give feedback.
-
Yes, I came into this issue too. It seems it will recycle the packet after mux. |
Beta Was this translation helpful? Give feedback.
-
@gemfield How can i deepcopy Packet? I did not get how to deepcopy with update_buffer. |
Beta Was this translation helpful? Give feedback.
-
Huh. I can see how it might claim ownership of the buffer in the packet after it is muxed. If that is the case, then I can explicitly take our own reference of it, and release it when the packet object is destroyed. |
Beta Was this translation helpful? Give feedback.
-
Reading the docs, it says "Ownership of the packet remains with the caller, and the decoder will not write to the packet." So I'm not sure there. |
Beta Was this translation helpful? Give feedback.
-
@mikeboers i just read ffmpeg's code, av_interleaved_write_frame copy the packet to another packet, and reset the original packet, it does not recycle the packet, just reset. so will we change av_interleaved_write_frame to av_write_frame or add some options to let user to choose use av_interleaved_write_frame or not? |
Beta Was this translation helpful? Give feedback.
-
pyav use av_interleaved_write_frame here not avcodec_send_packet |
Beta Was this translation helpful? Give feedback.
-
Lol... look at me going to read the docs and not even looking in the right place. For others, see here. I think we should increase the reference count when going into this function. |
Beta Was this translation helpful? Give feedback.
-
increase the reference count or use av_write_frame api. i think |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
The |
Beta Was this translation helpful? Give feedback.
-
Thanks, i will give a test. |
Beta Was this translation helpful? Give feedback.
-
Thanks, works fine now |
Beta Was this translation helpful? Give feedback.
-
I am using the latest git repo code (cloned from this repo 2 weeks ago) on Ubuntu 16.04.
I am doing the demux and remux with the following code(no decode and encode at all):
the mux_tmp_buffer is a packet list demuxed from input container.
But I got the following exceptions after run multiple times of above code.
And another quesions, how to deal with the packet.dts value when doing the mux (what I am doing now is packet_data.pts = packet_data.pts - video_dts_start, which seems ugly...)?
Thanks very much.
Beta Was this translation helpful? Give feedback.
All reactions