[Libav-user] Remuxing video file

Yuri Oleynikov (יורי אולייניקוב yurkao at gmail.com
Sun Feb 2 14:05:14 CET 2014


Thanks, Stefano.

Adding timestamp scaling partially solved the issue: in VLC everything work
find, however in WMP12 only audio stream is played.
Also tried with your remuxing code (
http://ffmpeg.org/doxygen/trunk/doc_2examples_2remuxing_8c-example.html) -
same result: no video playback.

I thought that the problem is codec, but it seems to me that it's not the
case because
 * the code is just remuxing streams
 * remuxing mp4->mp4 or mp4->megts produces correct output.
 * the original mp4 file is played correctly in both VLC and WMP.






2014-02-02 Stefano Sabatini <stefasab at gmail.com>:

> In data Saturday 2014-02-01 23:47:38 +0200, Yuri Oleynikov (יורי
> אולייניקוב ha scritto:
> > hello, i am new to libav. after reading documentation and examples for
> > serveral weeks, i tried to write simple remuxing (e.g mp4->avi) w/o
> > decoding/encoding, just like *ffmpeg -i inputfile.mp4 -f avi -c:v copy
> -an
> > output.avi.*
> >
> > however both VLC and windows media player refuse to play output avi file
> -
> > no video playback.
> > moreoever ffprobe on output file shows me incorrect duration and bitrate.
> >
> > moreover, though the output file contains only video streams and lacks
> > audio streams it's much bigger than the input file:
> >
> > -rw-r--r-- 1 me me 28689538 Feb  1 13:00 inputk.mp4
> > -rw-r--r-- 1 me me 77916554 Feb  1 13:40 output.avi
> >
> >
> >
> > i am definitely missing somesthing.
> > again, my appologies, i'm a new to libav*. :(
> > thanks for help.
> >
> > PS: sorry for long mail.
> >
> > my shortened code:
> >
> > avformat_open_input(&ic, infname, NULL, NULL);
> > avformat_find_stream_info(ic, NULL);
> >
> > oc = avformat_alloc_context();
> > oc->oformat = av_guess_format("avi", NULL, NULL);
> > /**no need to open encoders/decoders since i do no want to recode the
> > frames) **/
> > memmove(oc->filename, outfname, strlen(outfname));
> > avio_open(&oc->pb, outfname, AVIO_FLAG_WRITE);
> >
> > // stripped map input video streams to output video streams block
> >
> > avformat_write_header(oc, NULL);
> > for(i=0; av_read_frame(ic, &inpacket)>=0; i++,
> av_free_packet(&inpacket)) {
> >
> >         idx = inpacket.stream_index;
> >         stream = ic->streams[idx];
> >         if(stream_map[idx]==-1){
> >            continue;
> >         }
> >
> if(ic->streams[stream_map[idx]]->codec->codec_type!=AVMEDIA_TYPE_VIDEO)
> >            continue;
> >         av_copy_packet(&outpacket, &inpacket);
> >         outpacket.stream_index = stream_map[idx];
>
> You're missing timestamp rescaling here.
>
> >         av_interleaved_write_frame(oc, &outpacket);
> >         av_free_packet(&outpacket);
> > }
> >
> > av_write_trailer(oc);
> >
> > my full code:
> https://github.com/yurkao/libavformat-test/blob/master/remux.c
>
> I recently wrote a remuxing example and added it to doc/examples, you
> can compare it with your code and report in case you seem some problems
> with it.
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20140202/e3bb7d4f/attachment.html>


More information about the Libav-user mailing list