例子:
ffmpeg -i /home/otvcloud/rec/t.mp4 -loglevel trace -c copy /home/otvcloud/rec/1.mp4 -y
主循环如下:
while(1){
ret = transcode_step();
}
static int transcode_step(void)
{
ret = process_input(ist->file_index);
return reap_filters(0);
}
static int reap_filters(int flush)
{
for (i = 0; i < nb_output_streams; i++) {
if (!ost->filter)
continue; //拷贝的话,会执行此句。
}
}
如下堆栈,音视频拷贝在do_streamcopy。
static int process_input_packet(InputStream *ist, const AVPacket *pkt, int no_eof)
{
......
for (i = 0; pkt && i < nb_output_streams; i++) {
OutputStream *ost = output_streams[i];
if (!check_output_constraints(ist, ost) || ost->encoding_needed)
continue;
do_streamcopy(ist, ost, pkt); //里面会调用write_frame
}
}