[Libav-user] Can't get simple demux -> copy -> remux to work properly

Davin McCall davmac at davmac.org
Fri Jan 25 01:40:52 CET 2013


Hi,

I'm trying to get a simple demux / stream copy / remux program to work. 
The full source (reasonably small) is at:

     http://davmac.org/avtest.cc

I compile it using:
     g++ -Wall -o avtest src/avtest.cc -lavformat -lavcodec -lavutil 
-lpthread -lz -lbz2

I hope the strategy is pretty clear. It opens the input file (as 
specified on the command line) and writes to "test-out.avi". It just 
copies the streams, no decoding or encoding is performed.

It does produce a playable output, but something is wrong. For this 
small example input file:

     http://davmac.org/lucinda-part.avi

I can run ffprobe on the output:

     ffprobe -show_streams -count_frames -count_packets test-out.avi

... and get this output for the audio stream:

     duration_ts=N/A
     duration=N/A
     bit_rate=119232
     nb_frames=50
     nb_read_frames=248
     nb_read_packets=248

There are two issues: duration isn't specified, and nb_frames doesn't 
match the actual number of frames in the file.

If I copy the same input file to another avi container using ffmpeg, I 
do not see this issue. It only happens with my own program.

Can anyone see what's wrong with the program?

Thanks

Davin.




More information about the Libav-user mailing list