[FFmpeg-user] Question about concat protocol

Dennis Volodomanov volodomanov at gmail.com
Sun Oct 28 02:47:25 CEST 2012


Thanks for the reply and sorry for the delay.

The first VOB dump:
------------------------------

[PACKET]
codec_type=audio
stream_index=1
pts=20203
pts_time=0.224478
dts=20203
dts_time=0.224478
duration=941
duration_time=0.010456
convergence_duration=N/A
convergence_duration_time=N/A
size=2008
pos=16398
flags=K
[/PACKET]
[FRAME]
media_type=audio
key_frame=1
pkt_pts=20203
pkt_pts_time=0.224478
pkt_dts=20203
pkt_dts_time=0.224478
pkt_duration=941
pkt_duration_time=0.010456
pkt_pos=16398
sample_fmt=s16
nb_samples=502
channels=2
channel_layout=unknown
[/FRAME]
[PACKET]
codec_type=video
stream_index=0
pts=20203
pts_time=0.224478
dts=17200
dts_time=0.191111
duration=3003
duration_time=0.033367
convergence_duration=N/A
convergence_duration_time=N/A
size=41130
pos=2062
flags=K
[/PACKET]
[PACKET]
codec_type=video
stream_index=0
pts=N/A
pts_time=N/A
dts=20203
dts_time=0.224478
duration=3003
duration_time=0.033367
convergence_duration=N/A
convergence_duration_time=N/A
size=3826
pos=45070
flags=_
[/PACKET]
[FRAME]
media_type=video
key_frame=1
pkt_pts=20203
pkt_pts_time=0.224478
pkt_dts=20203
pkt_dts_time=0.224478
pkt_duration=3003
pkt_duration_time=0.033367
pkt_pos=2062
width=720
height=480
pix_fmt=yuv420p
sample_aspect_ratio=8:9
pict_type=I
coded_picture_number=0
display_picture_number=0
interlaced_frame=1
top_field_first=0
repeat_pict=0
reference=3
[/FRAME]

------------------------------
The second VOB dump:
------------------------------

[PACKET]
codec_type=audio
stream_index=1
pts=108914503
pts_time=1210.161144
dts=108914503
dts_time=1210.161144
duration=941
duration_time=0.010456
convergence_duration=N/A
convergence_duration_time=N/A
size=2008
pos=10254
flags=K
[/PACKET]
[FRAME]
media_type=audio
key_frame=1
pkt_pts=108914503
pkt_pts_time=1210.161144
pkt_dts=108914503
pkt_dts_time=1210.161144
pkt_duration=941
pkt_duration_time=0.010456
pkt_pos=10254
sample_fmt=s16
nb_samples=502
channels=2
channel_layout=unknown
[/FRAME]
[PACKET]
codec_type=audio
stream_index=1
pts=108915403
pts_time=1210.171144
dts=108915403
dts_time=1210.171144
duration=941
duration_time=0.010456
convergence_duration=N/A
convergence_duration_time=N/A
size=2008
pos=24590
flags=K
[/PACKET]
[FRAME]
media_type=audio
key_frame=1
pkt_pts=108915403
pkt_pts_time=1210.171144
pkt_dts=108915403
pkt_dts_time=1210.171144
pkt_duration=941
pkt_duration_time=0.010456
pkt_pos=24590
sample_fmt=s16
nb_samples=502
channels=2
channel_layout=unknown
[/FRAME]
[PACKET]
codec_type=audio
stream_index=1
pts=108916303
pts_time=1210.181144
dts=108916303
dts_time=1210.181144
duration=941
duration_time=0.010456
convergence_duration=N/A
convergence_duration_time=N/A
size=2008
pos=36878
flags=K
[/PACKET]
[FRAME]
media_type=audio
key_frame=1
pkt_pts=108916303
pkt_pts_time=1210.181144
pkt_dts=108916303
pkt_dts_time=1210.181144
pkt_duration=941
pkt_duration_time=0.010456
pkt_pos=36878
sample_fmt=s16
nb_samples=502
channels=2
channel_layout=unknown
[/FRAME]
[PACKET]
codec_type=audio
stream_index=1
pts=108917203
pts_time=1210.191144
dts=108917203
dts_time=1210.191144
duration=941
duration_time=0.010456
convergence_duration=N/A
convergence_duration_time=N/A
size=2008
pos=49166
flags=K
[/PACKET]
[FRAME]
media_type=audio
key_frame=1
pkt_pts=108917203
pkt_pts_time=1210.191144
pkt_dts=108917203
pkt_dts_time=1210.191144
pkt_duration=941
pkt_duration_time=0.010456
pkt_pos=49166
sample_fmt=s16
nb_samples=502
channels=2
channel_layout=unknown
[/FRAME]
[PACKET]
codec_type=video
stream_index=0
pts=108939013
pts_time=1210.433478
dts=108930004
dts_time=1210.333378
duration=3003
duration_time=0.033367
convergence_duration=N/A
convergence_duration_time=N/A
size=48564
pos=2062
flags=K
[/PACKET]
[PACKET]
codec_type=audio
stream_index=1
pts=108918253
pts_time=1210.202811
dts=108918253
dts_time=1210.202811
duration=941
duration_time=0.010456
convergence_duration=N/A
convergence_duration_time=N/A
size=2008
pos=63502
flags=K
[/PACKET]
[FRAME]
media_type=audio
key_frame=1
pkt_pts=108918253
pkt_pts_time=1210.202811
pkt_dts=108918253
pkt_dts_time=1210.202811
pkt_duration=941
pkt_duration_time=0.010456
pkt_pos=63502
sample_fmt=s16
nb_samples=502
channels=2
channel_layout=unknown
[/FRAME]
[PACKET]
codec_type=audio
stream_index=1
pts=108919153
pts_time=1210.212811
dts=108919153
dts_time=1210.212811
duration=941
duration_time=0.010456
convergence_duration=N/A
convergence_duration_time=N/A
size=2008
pos=75790
flags=K
[/PACKET]
[FRAME]
media_type=audio
key_frame=1
pkt_pts=108919153
pkt_pts_time=1210.212811
pkt_dts=108919153
pkt_dts_time=1210.212811
pkt_duration=941
pkt_duration_time=0.010456
pkt_pos=75790
sample_fmt=s16
nb_samples=502
channels=2
channel_layout=unknown
[/FRAME]
[PACKET]
codec_type=video
stream_index=0
pts=108933007
pts_time=1210.366744
dts=108933007
dts_time=1210.366744
duration=3003
duration_time=0.033367
convergence_duration=N/A
convergence_duration_time=N/A
size=19312
pos=57358
flags=_
[/PACKET]
[FRAME]
media_type=video
key_frame=0
pkt_pts=108933007
pkt_pts_time=1210.366744
pkt_dts=108933007
pkt_dts_time=1210.366744
pkt_duration=3003
pkt_duration_time=0.033367
pkt_pos=57358
width=720
height=480
pix_fmt=yuv420p
sample_aspect_ratio=8:9
pict_type=B
coded_picture_number=1
display_picture_number=0
interlaced_frame=1
top_field_first=0
repeat_pict=0
reference=0
[/FRAME]


Thanks for looking at this!

Best regards,

    Dennis

> Nicolas George <mailto:nicolas.george at normalesup.org>
> Thursday, 25 October 2012 5:56 AM
>
> The command looks right. Can you use ffprobe -show_packets -show_frames to
> show us the first few packets and frames of the files? More specifically,
> for the first file where the desync happens, all packets until at 
> least one
> audio frame and one video frames have been dumped: that would help
> understand what is going on.
>
> As for the memory problem, do you have an idea about the rhythm it 
> happens?
> It gives the first inkling about the origin of the leak.
>
> Regards,
>
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
> Dennis Volodomanov <mailto:volodomanov at gmail.com>
> Friday, 19 October 2012 12:57 AM
>
>
> I finally had a chance to do this and it's almost working, but not 
> quite...
>
> The problem is that (on the same files), if I use just "concat:" it's 
> all ok, but if I use -filters_complex, the moment the stitch occurs, 
> there's a tiny pause and then audio becomes a tiny bit out of synch. 
> The second problem, is that it seems to eat up a lot more memory (well 
> into 2GBs), while "concat" didn't seem to need that much. Memory 
> aside, the synch issue is serious, but perhaps I'm doing something wrong.
>
> The command line (FFmpeg latest from git):
>
> ffmpeg.exe -i "file1.vob" -i "file2.vob" -i "file3.vob" -i "file4.vob" 
> -c:v wmv2  -b:v 4288000  -r 29.97 -filter_complex "[0:v] 
> setpts=PTS-STARTPTS [v0]; [0:a] asetpts=PTS-STARTPTS [a0]; [1:v] 
> setpts=PTS-STARTPTS [v1]; [1:a] asetpts=PTS-STARTPTS [a1]; [2:v] 
> setpts=PTS-STARTPTS [v2]; [2:a] asetpts=PTS-STARTPTS [a2]; [3:v] 
> setpts=PTS-STARTPTS [v3]; [3:a] asetpts=PTS-STARTPTS [a3]; [v0] [a0] 
> [v1] [a1] [v2] [a2] [v3] [a3] concat=n=4:v=1:a=1 [v] [a]; [v] yadif, 
> format=yuv420p [vs]" -map [vs]  -c:a wmav2  -b:a 192000  -ar 48000 -ac 
> 2  -map [a]  -f asf -async 1  -thread_type slice "out.wmv"
>
> I've tried with and without "async 1" with the same result. With it, 
> it's a bit better, I think. The thread_type makes it go faster.
>
> As you can imagine, there's lots of output, but perhaps the 
> interesting bits are when one file ends and another starts. There's 
> the following, perhaps it makes sense to you:
>
> frame=68511 fps= 81 q=2.0 size=  991348kB time=00:38:06.38 
> bitrate=3551.9kbits/s
> frame=68553 fps= 81 q=2.0 size=  991716kB time=00:38:07.79 
> bitrate=3551.1kbits/s
> ac-tex damaged at 31 1
> [mpeg2video @ 04720920] Warning MVs not available
> [mpeg2video @ 04720920] concealing 1276 DC, 1276 AC, 1276 MV errors in 
> B frame
> [ac3 @ 017642a0] incomplete frame
> [ac3 @ 01735ba0] frame sync error
> Error while decoding stream #2:1: Error number -1 occurred
> frame=68590 fps= 81 q=2.0 size=  992473kB time=00:38:08.90 
> bitrate=3552.1kbits/s
> frame=68626 fps= 81 q=2.0 size=  993232kB time=00:38:10.09 
> bitrate=3552.9kbits/s
>
> I appreciate your help and input. Thanks!
>
>    Dennis
>
> Nicolas George <mailto:nicolas.george at normalesup.org>
> Thursday, 11 October 2012 9:01 PM
>
> This is possible, but since you want to combine several streams into one,
> you can not just use the -map option, you have to use the complex filters
> mechanism. Look in the doc, especially the examples for the concat filter.
>
> Regards,
>
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
> Dennis Volodomanov <mailto:volodomanov at gmail.com>
> Wednesday, 10 October 2012 12:01 AM
>
>
> Thanks for the reply!
>
> What I'd like, ideally, is to be able to do this:
>
> ffmpeg -i file1 {map video 0, audio 1 to output video 0, audio 1} -i 
> file2 {map video 1, audio 3 to output video 0, audio 1} -i file3 { map 
> video x, audio y to output video 0, audio 1 } outfile
>
> Basically, combining files, for each specifying the video and audio 
> stream that will create an output file with one video and one audio 
> stream based on those.
>
> Is it possible? If it is, what should the "-map" contain?
>
> Thanks!
>
>    Dennis
> Andrey Utkin <mailto:andrey.krieger.utkin at gmail.com>
> Tuesday, 9 October 2012 11:46 PM
> 2012/10/7 Dennis Volodomanov<volodomanov at gmail.com>:
>> Hello all!
>>
>> Is it possible to use the concat: protocol and -map at the same time to
>> choose which video/audio streams to pick from each file that's being
>> concat'ed? I tried various combinations, but it doesn't seem to work, I
>> suspect because FFmpeg considers the input as a single source.
>
> Correct, concat: input specification is a single input for ffmpeg.
>
>> I also tried specifying all files as separate -i "..." with each having it's
>> own set of -map, but that didn't work either, or most likely, I don't
>> understand how -map works in this case correctly. Can you please give me
>> some advice on how to use -map to pick video/audio streams from multiple
>> files to be joined into one?
>
> It depends on what you wanted to do, and what you got.
> If you want to join video streams into single one, there're solutions,
> check it in FAQ
> http://ffmpeg.org/faq.html#How-can-I-concatenate-video-files
>


More information about the ffmpeg-user mailing list