<div dir="ltr"><div class="gmail_default" style="font-family:'courier new',monospace;font-size:small;color:rgb(51,0,0)">Thanks, Stefano.</div><div class="gmail_default" style="font-family:'courier new',monospace;font-size:small;color:rgb(51,0,0)">

<br></div><div class="gmail_default" style="font-family:'courier new',monospace;font-size:small;color:rgb(51,0,0)">Adding timestamp scaling partially solved the issue: in VLC everything work find, however in WMP12 only audio stream is played.</div>

<div class="gmail_default" style="font-family:'courier new',monospace;font-size:small;color:rgb(51,0,0)">Also tried with your remuxing code (<a href="http://ffmpeg.org/doxygen/trunk/doc_2examples_2remuxing_8c-example.html">http://ffmpeg.org/doxygen/trunk/doc_2examples_2remuxing_8c-example.html</a>) - same result: no video playback.</div>

<div class="gmail_default" style="font-family:'courier new',monospace;font-size:small;color:rgb(51,0,0)"><br></div><div class="gmail_default" style="font-family:'courier new',monospace;font-size:small;color:rgb(51,0,0)">

I thought that the problem is codec, but it seems to me that it's not the case because </div><div class="gmail_default" style="font-family:'courier new',monospace;font-size:small;color:rgb(51,0,0)"> * the code is just remuxing streams </div>

<div class="gmail_default" style="font-family:'courier new',monospace;color:rgb(51,0,0)"> * remuxing mp4->mp4 or mp4->megts produces correct output.</div><div class="gmail_default" style="font-family:'courier new',monospace;font-size:small;color:rgb(51,0,0)">

 * the original mp4 file is played correctly in both VLC and WMP.</div><div class="gmail_default" style="font-family:'courier new',monospace;font-size:small;color:rgb(51,0,0)"><br></div><div class="gmail_default" style="font-family:'courier new',monospace;font-size:small;color:rgb(51,0,0)">

<br></div><div class="gmail_default" style="font-family:'courier new',monospace;font-size:small;color:rgb(51,0,0)"><br></div><div class="gmail_default" style="font-family:'courier new',monospace;font-size:small;color:rgb(51,0,0)">

<br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-02-02 Stefano Sabatini <span dir="ltr"><<a href="mailto:stefasab@gmail.com" target="_blank">stefasab@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

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