Otherwise the user might get a silence padded frame in the beginning or in the
middle of the encoding.
Some other bug uncovered this:
./ffmpeg -loglevel verbose -y -f data -i /dev/zero \
-filter_complex "nullsrc=s=60x60:d=10[v0];sine=d=10[a]" \
-map '[v0]' -c✌️0 rawvideo \
-map '[a]' -c🅰️0 mp2 \
-f mpegts out.ts
Signed-off-by: Marton Balint <cus@passwd.hu>
Encoder frame_number may be double-counted if some frames are cached and then flushed.
Take qsv encoder (some frames are cached firsty for asynchronism) as example,
./ffmpeg -loglevel verbose -hwaccel qsv -c:v h264_qsv -i in.mp4 -vframes 100 -c:v h264_qsv out.mp4
frame_number passed to encoder is double-counted and larger than the accurate value.
Libx264 encoding with B frames can also reproduce it.
Signed-off-by: Zhong Li <zhong.li@intel.com>
remove redundant av_init_packet after av_packet_unref.
av_packet_unref have call av_init_packet and reset the packet size.
Signed-off-by: Jun Zhao <mypopydev@gmail.com>
* commit '48bb0da050329e5111b00a12dfc154b7e78fb3a3':
lavc: Drop deprecated way of setting audio delay on encode
Merged-by: James Almer <jamrial@gmail.com>
* commit '328cd2b599bc2d0d38f3c12606fa2a66eeec016e':
lavc: move encoding-related code from utils.c to a new file
Merged-by: James Almer <jamrial@gmail.com>