最近在研究利用ffmpeg的源码打包TS的问题,将研究的过程记录下来备忘。
1. 先测试以下ffmpeg的录制屏幕的功能
ffmpeg -f x11grab -y -r 24 -s 800x600 -i :0.0+100,100 -vcodec mpeg2video -f mpegts ./output.ts
ffmpeg -f alsa -i hw:0 -f x11grab -y -r 24 -s 800x600 -i :0.0+100,100 -acodec mp2 -vcodec mpeg2video -f mpegts ./output.ts
ffmpeg -f alsa -i hw:0 alsaout.wav
2. 跟踪用TS流录制
测试命令:ffmpeg -f alsa -i hw:0 -f x11grab -y -r 24 -s 800x600 -i :0.0+100,100 -acodec mp2 -vcodec mpeg4 -f mpegts -b 6291456 ./output.ts
安装cgdb: sudo apt-get install cgdb
启动cgdb:cgdb ffmpeg_g
(gdb) set args -f alsa -i hw:0 -f x11grab -y -r 24 -s 800x600 -i :0.0+100,100 -acodec mp2 -vcodec mpeg4 -f mpegts -b 6291456 ./output.ts
(gdb) b main
Breakpoint 1 at 0x43d070: file ffmpeg.c, line 4535.
(gdb)
然后单布跟踪代码。