<div dir="ltr">Hi,<br><br>I would like to concat MOV files without re-encoding. I want to do it on iOS (iPhone). All the MOV files are recorded with the same settings, no difference in dimensions or encoding profiles.<br>I have succeeded to do it with the command line ffmpeg:<br>
<div><span style="background-color:transparent;color:rgb(83,83,83);font-family:'Trebuchet MS';font-size:13px;white-space:pre-wrap">ffmpeg -re -f concat -i files.txt -c copy ...</span></div><div>But I have difficulties using the libraries.<br>
I think the demuxing part is ok, I have the h.264+AAC packets. After demuxing I shift the PTS and DTS info of each packet to have ascending values in the joined MOV file.<br>The hard part is the muxing.<br>I have built the ffmpeg libs with x264 lib, so it can be used if necessary, but I am not sure whether I need the x264 codec since I don't want to re-encode the MOV files, I just want to join them.<div>
<br><u>Problems I have encountered:</u></div><div><u><br></u>1) In this case I do not use x264 codec, At muxing I create the stream with NULL codec parameter. I have successful writing of header, packets and trailer. All the function calls return with zero error code. However, the output can be opened, but black "screen" is displayed during playback. FFprobe report is attached. I have also examined the output with MediaInfo tool. I have attached that report as well (MediaInfo report - without x264 codec.txt). As you can see there is no h.264 profile or pixel info found that might be a problem. </div>
<div><br><div>2) In this case I use x264 codec with functions: avcodec_find_encoder, avformat_new_stream and avcodec_open2. Again: no decode-encode! In this case I have much more metadata in the output file like h.264 profile and pixel info (YUV), but the av_interleaved_write_frame call simply does nothing but returns success code (0). No packet is written to the file. :( I don't know how this could happen. fwrite works, but results in un-openable file.</div>
<div>I have also attached the MediaInfo report of this output (MediaInfo report - with x264 codec.txt).</div><div><br></div><div><u>Questions:</u></div><div>- How should I process the demuxed packets to feed the muxer?</div>
<div>- What format context and codec context setting should be done including AVOption settings?</div><div>- Should I use the x264 codec to do this? I just vant to re-mux the chunks into a single joined file.</div><div>- The chunks have their own header/trailer. Should I somehow filter the demuxed packets to skip them?</div>
<div>- The final goal is creating a network stream (RTP or RTMP) - also with re-muxing and without re-encoding. It works with command line ffmpeg:</div><div><span style="background-color:transparent;color:rgb(83,83,83);font-family:'Trebuchet MS';font-size:13px;white-space:pre-wrap">ffmpeg -re -f concat -i files.txt -vcodec copy -an -f rtp rtp://<a href="http://127.0.0.1:20000">127.0.0.1:20000</a> -vn -acodec copy -f rtp rtp://<a href="http://127.0.0.1:30000">127.0.0.1:30000</a></span></div>
<div>Concatenating to MOV format is only an intermediate pilot. Is it recommended to work on the network format since it is so different task that there is no benefit of solving the MOV format muxing?</div><div><br></div>
<div>Any help, advice, suggestion is greatly appreciated.</div><div>I can reveal code to make deeper investigation possible.</div><div><br></div><div>Regards,</div><div>Gyula<div><br></div></div></div></div></div>