Hi all,
 I'm trying to put together a simple streaming solution - a fifo file
is fed with a avi transcoded from a dvb device, the "streamer" read
the fifo and skips the packets until a "clent" connects, then a valid
avi header is created and the packets get duplicated to the "clent"
which is then able to decode almost valid avi file format.
 I've used some of the tutorials around the web plus the ffmpeg.c file
to create something that does simple packet-to-packet copy of a file
to other file. The sources, including 2 lines of Makefile are attached
to this e-mail. The program "almost" work. It doubles the file but
it's playable with both video and audio. If you interrupt at prompt
"N: av_write_trailer() stars" the file is "normal size" yet audio is
broken.  dump_format() segfaults on output context so I've commented
it out in main.c line 105. Typical session looks like:

s...@sdrlt ~/devroot/sdrlive/build $ ./sdrlive  ~/devroot/test.avi
Input #0, avi, from '/home/sdr/devroot/test.avi':
  Duration: 00:03:14.35, start: 0.000000, bitrate: 982 kb/s
    Stream #0.0: Video: mpeg4, yuv420p, 640x480 [PAR 1:1 DAR 4:3], 25
tbr, 25 tbn, 25 tbc
    Stream #0.1: Audio: mp3, 48000 Hz, 2 channels, s16, 80 kb/s
N: SETUP DONE!
N: EOF! stats: pcnt:12900 vpcnt:4802 (kvpcnt:39) apcnt:8098
(kapcnt:8098) upcnt:0
N: av_close_input_file() stars
N: av_close_input_file() ends for 0s
N: av_write_trailer() stars
N: av_write_trailer() ends for 17s
N: url_fclose() stars
N: url_fclose() ends for 0s
s...@sdrlt ~/devroot/sdrlive/build $

My main loop is basically:

    while(av_read_frame(ic, &packet)>=0) {
        if(packet.stream_index==ivsi) { //vodeo packet
           packet.stream_index=ovs->index;
           av_interleaved_write_frame(oc, &packet);
        } else if (packet.stream_index==iasi){ //audio packet
                packet.stream_index=oas->index;
                av_interleaved_write_frame(oc, &packet);
        } else { //ignore other packets
        }
        av_free_packet(&packet);
    }

What am I doing wrong? How do I stop dump_format() segfaulting on
output context?

Best regards
   Stoian Ivanov

Attachment: sdrlive_src.tar.bz2
Description: BZip2 compressed data

_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to