Discussion:
[Ffmpeg-user] Video and audio sync problems after concatenation
Josh Millstein
2007-01-12 18:10:45 UTC
Permalink
Hello. Here is what I'm doing. I'm concatenating mp4, mov, avi files. I'm
doing this by first converting each video to mpg and then cat'in them and
running them through ffmpeg again. I finally got a way to get this to work,
kinda. The video is concatenated, the audio is concatenated, and they both
play in the mpg that is outputted, but they are out of sync. I think the
syncing problem is due to the fact that I have to convert from whatever the
original format is to mpg, which means I have to change the frame rate.
mpeg1video only uses 30 and 24 or something like that. So I have input
sources at 15 fps that get converted to 30 or 24 fps that get converted to
30. The end result, I think, is that frames are being doubled to get the
fps, which makes video play slower than the audio. It also gets worse and
worse (sync) as the concatenated video progresses. Can anybody help me
here? I read something about using -vsync with -map so I can sync the video
to the audio by dropping or adding frames. Here are all the commands I use
in this process. Thanks for the input. They are labeled $one ... $n in the
order that I call the commands from php exec(). A couple things I've tried
lately... On $one and $two I have toggeled the use of -r 30 for the input
file. On $twelve I have tried to convert back to -r 15 in hopes it would
re-sync.

$one = "ffmpeg -y -r 30 -i ./files/11684546964708514650724.82824test2.mov -s
400x300 -vcodec mpeg1video -acodec mp2 -r 30 ./downloads/OvSOne.mpg";

$two = "ffmpeg -y -r 30 -i
./files/1168466060313378706743.940711play_mayer_life.mp4 -s 400x300 -vcodec
mpeg1video -acodec mp2 -r 30 ./downloads/OvSTwo.mpg";

$three = "ffmpeg -y -i ./downloads/OvSOne.mpg -vcodec mpeg1video -an -f
mpeg1video ./downloads/vSOne.mpg";

$four = "ffmpeg -y -i ./downloads/OvSTwo.mpg -vcodec mpeg1video -an -f
mpeg1video ./downloads/vSTwo.mpg";

$five = "ffmpeg -y -i ./downloads/OvSTwo.mpg -acodec mp2 -vn -f mp2
./downloads/vSTwo.mp2";

$six = "ffmpeg -y -i ./downloads/OvSOne.mpg -acodec mp2 -vn -f mp2
./downloads/vSOne.mp2";

$seven = "cat ./downloads/vSOne.mpg ./downloads/vSTwo.mpg >
./downloads/com.mpg";

$eight = "cat ./downloads/vSOne.mp2 ./downloads/vSTwo.mp2 >
./downloads/com.mp2";

$nine = "ffmpeg -y -i ./downloads/com.mpg -an -vcodec mpeg1video -f
mpeg1video ./downloads/outOne.mpg";

$ten = "ffmpeg -y -i ./downloads/com.mp2 -acodec mp2 -vn
./downloads/outOne.mp2";

$eleven = "ffmpeg -y -i ./downloads/outOne.mp3 -i ./downloads/outOne.mpg -f
vob ./downloads/out.mpg";

$twelve = "ffmpeg -y -i ./downloads/out.mpg -acodec mp3 -r 15 -f mov
./downloads/out.mov";
Víctor Paesa
2007-01-12 18:49:07 UTC
Permalink
Hi,
Post by Josh Millstein
Hello. Here is what I'm doing. I'm concatenating mp4, mov, avi files.
I'm
doing this by first converting each video to mpg and then cat'in them and
running them through ffmpeg again. I finally got a way to get this to work,
kinda. The video is concatenated, the audio is concatenated, and they both
play in the mpg that is outputted, but they are out of sync. I think the
syncing problem is due to the fact that I have to convert from whatever the
original format is to mpg, which means I have to change the frame rate.
mpeg1video only uses 30 and 24 or something like that. So I have input
sources at 15 fps that get converted to 30 or 24 fps that get converted to
30. The end result, I think, is that frames are being doubled to get the
fps, which makes video play slower than the audio. It also gets worse and
worse (sync) as the concatenated video progresses. Can anybody help me
here? I read something about using -vsync with -map so I can sync the video
to the audio by dropping or adding frames. Here are all the commands I use
in this process. Thanks for the input. They are labeled $one ... $n in the
order that I call the commands from php exec(). A couple things I've tried
lately... On $one and $two I have toggeled the use of -r 30 for the input
file. On $twelve I have tried to convert back to -r 15 in hopes it would
re-sync.
$one = "ffmpeg -y -r 30 -i ./files/11684546964708514650724.82824test2.mov -s
400x300 -vcodec mpeg1video -acodec mp2 -r 30 ./downloads/OvSOne.mpg";
$two = "ffmpeg -y -r 30 -i
./files/1168466060313378706743.940711play_mayer_life.mp4 -s 400x300 -vcodec
mpeg1video -acodec mp2 -r 30 ./downloads/OvSTwo.mpg";
I believe you don't need to set -r 30 onto your input files, set it only
to your output files.
Post by Josh Millstein
$three = "ffmpeg -y -i ./downloads/OvSOne.mpg -vcodec mpeg1video -an -f
mpeg1video ./downloads/vSOne.mpg";
$four = "ffmpeg -y -i ./downloads/OvSTwo.mpg -vcodec mpeg1video -an -f
mpeg1video ./downloads/vSTwo.mpg";
$five = "ffmpeg -y -i ./downloads/OvSTwo.mpg -acodec mp2 -vn -f mp2
./downloads/vSTwo.mp2";
$six = "ffmpeg -y -i ./downloads/OvSOne.mpg -acodec mp2 -vn -f mp2
./downloads/vSOne.mp2";
$seven = "cat ./downloads/vSOne.mpg ./downloads/vSTwo.mpg >
./downloads/com.mpg";
$eight = "cat ./downloads/vSOne.mp2 ./downloads/vSTwo.mp2 >
./downloads/com.mp2";
$nine = "ffmpeg -y -i ./downloads/com.mpg -an -vcodec mpeg1video -f
mpeg1video ./downloads/outOne.mpg";
$ten = "ffmpeg -y -i ./downloads/com.mp2 -acodec mp2 -vn
./downloads/outOne.mp2";
$eleven = "ffmpeg -y -i ./downloads/outOne.mp3 -i ./downloads/outOne.mpg -f
vob ./downloads/out.mpg";
$twelve = "ffmpeg -y -i ./downloads/out.mpg -acodec mp3 -r 15 -f mov
./downloads/out.mov";
Regards,
V?ctor
Josh Millstein
2007-01-15 17:04:52 UTC
Permalink
Post by Josh Millstein
Hello. Here is what I'm doing. I'm concatenating mp4, mov, avi files. I'm
doing this by first converting each video to mpg and then cat'in them and
running them through ffmpeg again. I finally got a way to get this to work,
kinda. The video is concatenated, the audio is concatenated, and they both
play in the mpg that is outputted, but they are out of sync. I think the
syncing problem is due to the fact that I have to convert from whatever the
original format is to mpg, which means I have to change the frame rate.
mpeg1video only uses 30 and 24 or something like that. So I have input
sources at 15 fps that get converted to 30 or 24 fps that get converted to
30. The end result, I think, is that frames are being doubled to get the
fps, which makes video play slower than the audio. It also gets worse and
worse (sync) as the concatenated video progresses. Can anybody help me
here? I read something about using -vsync with -map so I can sync the video
to the audio by dropping or adding frames. Here are all the commands I use
in this process. Thanks for the input. They are labeled $one ... $n in the
order that I call the commands from php exec(). A couple things I've tried
lately... On $one and $two I have toggeled the use of -r 30 for the input
file. On $twelve I have tried to convert back to -r 15 in hopes it would
re-sync.
$one = "ffmpeg -y -r 30 -i ./files/11684546964708514650724.82824test2.mov -s
400x300 -vcodec mpeg1video -acodec mp2 -r 30 ./downloads/OvSOne.mpg";
$two = "ffmpeg -y -r 30 -i
./files/1168466060313378706743.940711play_mayer_life.mp4 -s 400x300 -vcodec
mpeg1video -acodec mp2 -r 30 ./downloads/OvSTwo.mpg";
$three = "ffmpeg -y -i ./downloads/OvSOne.mpg -vcodec mpeg1video -an -f
mpeg1video ./downloads/vSOne.mpg";
$four = "ffmpeg -y -i ./downloads/OvSTwo.mpg -vcodec mpeg1video -an -f
mpeg1video ./downloads/vSTwo.mpg";
$five = "ffmpeg -y -i ./downloads/OvSTwo.mpg -acodec mp2 -vn -f mp2
./downloads/vSTwo.mp2";
$six = "ffmpeg -y -i ./downloads/OvSOne.mpg -acodec mp2 -vn -f mp2
./downloads/vSOne.mp2";
$seven = "cat ./downloads/vSOne.mpg ./downloads/vSTwo.mpg >
./downloads/com.mpg";
$eight = "cat ./downloads/vSOne.mp2 ./downloads/vSTwo.mp2 >
./downloads/com.mp2";
$nine = "ffmpeg -y -i ./downloads/com.mpg -an -vcodec mpeg1video -f
mpeg1video ./downloads/outOne.mpg";
$ten = "ffmpeg -y -i ./downloads/com.mp2 -acodec mp2 -vn
./downloads/outOne.mp2";
$eleven = "ffmpeg -y -i ./downloads/outOne.mp3 -i ./downloads/outOne.mpg -f
vob ./downloads/out.mpg";
$twelve = "ffmpeg -y -i ./downloads/out.mpg -acodec mp3 -r 15 -f mov
./downloads/out.mov";
I'm trying this vsync and map combo like crazy, but nothing.

$eleven = "ffmpeg -y -i ./downloads/outOne.mp3 -i ./downloads/outOne.mpg
-vsync -map 0:1 -f vob ./downloads/out.mpg";

or

$eleven = "ffmpeg -y -i ./downloads/outOne.mp3 -i ./downloads/outOne.mpg
-vsync -map 0:1 -map 1:1 -f vob ./downloads/out.mpg";

or

$eleven = "ffmpeg -y -i ./downloads/outOne.mp3 -i ./downloads/outOne.mpg
-vsync -map 0.0:1.0 -f vob ./downloads/out.mpg";

or

$eleven = "ffmpeg -y -i ./downloads/outOne.mp3 -i ./downloads/outOne.mpg
-vsync -map 0.0:1.0 0.1:1.0 -f vob ./downloads/out.mpg";

I don't know what is going on. Just want to use vsync and map together to
sync the video stream to the audio stream by dropping frames if that is
possible.
Post by Josh Millstein
_______________________________________________
ffmpeg-user mailing list
ffmpeg-user at mplayerhq.hu
http://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-user
Godwin Stewart
2007-01-15 17:11:53 UTC
Permalink
On Mon, 15 Jan 2007 11:04:52 -0600, Josh Millstein
Post by Josh Millstein
I don't know what is going on.
Run them on a command line and then you'll get precise error messages
that might guide you.

Once you've got *that* working you can invoke the commands from PHP.

--
G. Stewart - godwin.stewart at gmail.com

"I can remember when a good politician had to be 75 percent ability and
25 percent actor, but I can well see the day when the reverse could be
true."
-- Harry Truman
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-user/attachments/20070115/7d33ab35/attachment.pgp>
Michel Bardiaux
2007-01-15 17:19:29 UTC
Permalink
Post by Josh Millstein
Hello. Here is what I'm doing. I'm concatenating mp4, mov, avi files. I'm
doing this by first converting each video to mpg and then cat'in them and
running them through ffmpeg again. I finally got a way to get this to work,
kinda. The video is concatenated, the audio is concatenated, and they both
play in the mpg that is outputted, but they are out of sync. I think the
syncing problem is due to the fact that I have to convert from whatever the
original format is to mpg, which means I have to change the frame rate.
mpeg1video only uses 30 and 24 or something like that. So I have input
sources at 15 fps that get converted to 30 or 24 fps that get converted to
30. The end result, I think, is that frames are being doubled to get the
fps, which makes video play slower than the audio. It also gets worse and
worse (sync) as the concatenated video progresses. Can anybody help me
here? I read something about using -vsync with -map so I can sync the video
to the audio by dropping or adding frames. Here are all the commands I use
in this process. Thanks for the input. They are labeled $one ... $n in the
order that I call the commands from php exec(). A couple things I've tried
lately... On $one and $two I have toggeled the use of -r 30 for the input
file. On $twelve I have tried to convert back to -r 15 in hopes it would
re-sync.
$one = "ffmpeg -y -r 30 -i ./files/11684546964708514650724.82824test2.mov -s
400x300 -vcodec mpeg1video -acodec mp2 -r 30 ./downloads/OvSOne.mpg";
$two = "ffmpeg -y -r 30 -i
./files/1168466060313378706743.940711play_mayer_life.mp4 -s 400x300 -vcodec
mpeg1video -acodec mp2 -r 30 ./downloads/OvSTwo.mpg";
Stop right here. Do these 2 mpg's have correct A/V sync? If not, then
concatenation is hopeless - my point along the whole thread has been
that concatenation works well *only* if the timestamps are correct. And
better post the command output for these 2.

It is totally hopeless to debug a sequence of 12 commands by considering
just the final stage. The files have to be validated at every stage.
--
Michel Bardiaux
R&D Director
T +32 [0] 2 790 29 41
F +32 [0] 2 790 29 02
E mailto:mbardiaux at mediaxim.be

Mediaxim NV/SA
Vorstlaan 191 Boulevard du Souverain
Brussel 1160 Bruxelles
http://www.mediaxim.com/
Josh Millstein
2007-01-15 17:32:33 UTC
Permalink
Post by Michel Bardiaux
Post by Josh Millstein
Hello. Here is what I'm doing. I'm concatenating mp4, mov, avi files. I'm
doing this by first converting each video to mpg and then cat'in them and
running them through ffmpeg again. I finally got a way to get this to work,
kinda. The video is concatenated, the audio is concatenated, and they both
play in the mpg that is outputted, but they are out of sync. I think the
syncing problem is due to the fact that I have to convert from whatever the
original format is to mpg, which means I have to change the frame rate.
mpeg1video only uses 30 and 24 or something like that. So I have input
sources at 15 fps that get converted to 30 or 24 fps that get converted to
30. The end result, I think, is that frames are being doubled to get the
fps, which makes video play slower than the audio. It also gets worse and
worse (sync) as the concatenated video progresses. Can anybody help me
here? I read something about using -vsync with -map so I can sync the video
to the audio by dropping or adding frames. Here are all the commands I use
in this process. Thanks for the input. They are labeled $one ... $n in the
order that I call the commands from php exec(). A couple things I've tried
lately... On $one and $two I have toggeled the use of -r 30 for the input
file. On $twelve I have tried to convert back to -r 15 in hopes it would
re-sync.
$one = "ffmpeg -y -r 30 -i ./files/11684546964708514650724.82824test2.mov -s
400x300 -vcodec mpeg1video -acodec mp2 -r 30 ./downloads/OvSOne.mpg";
$two = "ffmpeg -y -r 30 -i
./files/1168466060313378706743.940711play_mayer_life.mp4 -s 400x300 -vcodec
mpeg1video -acodec mp2 -r 30 ./downloads/OvSTwo.mpg";
Stop right here. Do these 2 mpg's have correct A/V sync? If not, then
concatenation is hopeless - my point along the whole thread has been
that concatenation works well *only* if the timestamps are correct. And
better post the command output for these 2.
It is totally hopeless to debug a sequence of 12 commands by considering
just the final stage. The files have to be validated at every stage.
The audio and video don't lose sync until I concatenate them into one file
at the end. When I initially change them to mpgs eg $one and $two from
above, the files play just fine.

Output from $one.

FFmpeg version SVN-r7231, Copyright (c) 2000-2006 Fabrice Bellard, et al.
configuration: --prefix=/usr --mandir=${prefix}/share/man --enable-gpl
--enable-pp --enable-pthreads --enable-vorbis --enable-libogg --enable-a52
--enable-dts --enable-libgsm --disable-debug --enable-mp3lame --enable-faad
libavutil version: 49.1.0
libavcodec version: 51.25.0
libavformat version: 51.6.0
built on Dec 7 2006 15:18:07, gcc: 3.3.5 (Debian 1:3.3.5-13)

Seems that stream 0 comes from film source: 3000.00 (90000/30) -> 15.00
(15/1)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from
'./files/11684546964708514650724.82824test2.mov':
Duration: 00:00:04.2, start: 0.000000, bitrate: 172 kb/s
Stream #0.0(eng): Video: h264, yuv420p, 320x240, 15.00 fps(r)
Stream #0.1(eng): Audio: aac, 44100 Hz, stereo
Output #0, mpeg, to './downloads/OvSOne.mpg':
Stream #0.0: Video: mpeg1video, yuv420p, 400x300, q=2-31, 200 kb/s, 30.00
fps(c)
Stream #0.1: Audio: mp2, 44100 Hz, stereo, 64 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1
Press [q] to stop encoding
frame= 126 q=2.8 Lsize= 254kB time=4.0 bitrate= 513.9kbits/s
video:40kB audio:32kB global headers:0kB muxing overhead 255.550695%


Output from $two

FFmpeg version SVN-r7231, Copyright (c) 2000-2006 Fabrice Bellard, et al.
configuration: --prefix=/usr --mandir=${prefix}/share/man --enable-gpl
--enable-pp --enable-pthreads --enable-vorbis --enable-libogg --enable-a52
--enable-dts --enable-libgsm --disable-debug --enable-mp3lame --enable-faad
libavutil version: 49.1.0
libavcodec version: 51.25.0
libavformat version: 51.6.0
built on Dec 7 2006 15:18:07, gcc: 3.3.5 (Debian 1:3.3.5-13)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from
'./files/1168466060313378706743.940711play_mayer_life.mp4':
Duration: 00:03:37.9, start: 0.000000, bitrate: 344 kb/s
Stream #0.0(und): Video: h264, yuv420p, 320x240, 15.00 fps(r)
Stream #0.1(und): Audio: aac, 44100 Hz, stereo
Output #0, mpeg, to './downloads/OvSTwo.mpg':
Stream #0.0: Video: mpeg1video, yuv420p, 400x300, q=2-31, 200 kb/s, 30.00
fps(c)
Stream #0.1: Audio: mp2, 44100 Hz, stereo, 64 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1
Press [q] to stop encoding
[mpeg1video @ 0x84b56d8]warning, clipping 1 dct coefficients to -255..255
frame= 6536 q=2.2 Lsize= 7248kB time=217.8 bitrate= 272.7kbits/s
video:361kB audio:1701kB global headers:0kB muxing overhead 251.416185%
Michel Bardiaux
2007-01-16 10:25:52 UTC
Permalink
Post by Josh Millstein
Post by Michel Bardiaux
Post by Josh Millstein
Hello. Here is what I'm doing. I'm concatenating mp4, mov, avi files. I'm
doing this by first converting each video to mpg and then cat'in them and
running them through ffmpeg again. I finally got a way to get this to work,
kinda. The video is concatenated, the audio is concatenated, and they both
play in the mpg that is outputted, but they are out of sync. I think the
syncing problem is due to the fact that I have to convert from whatever the
original format is to mpg, which means I have to change the frame rate.
mpeg1video only uses 30 and 24 or something like that. So I have input
sources at 15 fps that get converted to 30 or 24 fps that get converted to
30. The end result, I think, is that frames are being doubled to get the
fps, which makes video play slower than the audio. It also gets worse and
worse (sync) as the concatenated video progresses. Can anybody help me
here? I read something about using -vsync with -map so I can sync the video
to the audio by dropping or adding frames. Here are all the commands I use
in this process. Thanks for the input. They are labeled $one ... $n in the
order that I call the commands from php exec(). A couple things I've tried
lately... On $one and $two I have toggeled the use of -r 30 for the input
file. On $twelve I have tried to convert back to -r 15 in hopes it would
re-sync.
$one = "ffmpeg -y -r 30 -i ./files/11684546964708514650724.82824test2.mov -s
400x300 -vcodec mpeg1video -acodec mp2 -r 30 ./downloads/OvSOne.mpg";
$two = "ffmpeg -y -r 30 -i
./files/1168466060313378706743.940711play_mayer_life.mp4 -s 400x300 -vcodec
mpeg1video -acodec mp2 -r 30 ./downloads/OvSTwo.mpg";
Stop right here. Do these 2 mpg's have correct A/V sync? If not, then
concatenation is hopeless - my point along the whole thread has been
that concatenation works well *only* if the timestamps are correct. And
better post the command output for these 2.
It is totally hopeless to debug a sequence of 12 commands by considering
just the final stage. The files have to be validated at every stage.
The audio and video don't lose sync until I concatenate them into one file
at the end. When I initially change them to mpgs eg $one and $two from
above, the files play just fine.
Output from $one.
FFmpeg version SVN-r7231, Copyright (c) 2000-2006 Fabrice Bellard, et al.
configuration: --prefix=/usr --mandir=${prefix}/share/man --enable-gpl
--enable-pp --enable-pthreads --enable-vorbis --enable-libogg --enable-a52
--enable-dts --enable-libgsm --disable-debug --enable-mp3lame --enable-faad
libavutil version: 49.1.0
libavcodec version: 51.25.0
libavformat version: 51.6.0
built on Dec 7 2006 15:18:07, gcc: 3.3.5 (Debian 1:3.3.5-13)
Seems that stream 0 comes from film source: 3000.00 (90000/30) -> 15.00
(15/1)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from
Duration: 00:00:04.2, start: 0.000000, bitrate: 172 kb/s
Stream #0.0(eng): Video: h264, yuv420p, 320x240, 15.00 fps(r)
Stream #0.1(eng): Audio: aac, 44100 Hz, stereo
Stream #0.0: Video: mpeg1video, yuv420p, 400x300, q=2-31, 200 kb/s, 30.00
fps(c)
Stream #0.1: Audio: mp2, 44100 Hz, stereo, 64 kb/s
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1
Press [q] to stop encoding
frame= 126 q=2.8 Lsize= 254kB time=4.0 bitrate= 513.9kbits/s
video:40kB audio:32kB global headers:0kB muxing overhead 255.550695%
Output from $two
FFmpeg version SVN-r7231, Copyright (c) 2000-2006 Fabrice Bellard, et al.
configuration: --prefix=/usr --mandir=${prefix}/share/man --enable-gpl
--enable-pp --enable-pthreads --enable-vorbis --enable-libogg --enable-a52
--enable-dts --enable-libgsm --disable-debug --enable-mp3lame --enable-faad
libavutil version: 49.1.0
libavcodec version: 51.25.0
libavformat version: 51.6.0
built on Dec 7 2006 15:18:07, gcc: 3.3.5 (Debian 1:3.3.5-13)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from
Duration: 00:03:37.9, start: 0.000000, bitrate: 344 kb/s
Stream #0.0(und): Video: h264, yuv420p, 320x240, 15.00 fps(r)
Stream #0.1(und): Audio: aac, 44100 Hz, stereo
Stream #0.0: Video: mpeg1video, yuv420p, 400x300, q=2-31, 200 kb/s, 30.00
fps(c)
Stream #0.1: Audio: mp2, 44100 Hz, stereo, 64 kb/s
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1
Press [q] to stop encoding
frame= 6536 q=2.2 Lsize= 7248kB time=217.8 bitrate= 272.7kbits/s
video:361kB audio:1701kB global headers:0kB muxing overhead 251.416185%
Josh Millstein
2007-01-16 18:13:13 UTC
Permalink
Post by Josh Millstein
Post by Michel Bardiaux
Post by Josh Millstein
Hello. Here is what I'm doing. I'm concatenating mp4, mov, avi files.
I'm
doing this by first converting each video to mpg and then cat'in them and
running them through ffmpeg again. I finally got a way to get this to
work,
kinda. The video is concatenated, the audio is concatenated, and they
both
play in the mpg that is outputted, but they are out of sync. I think the
syncing problem is due to the fact that I have to convert from whatever
the
original format is to mpg, which means I have to change the frame rate.
mpeg1video only uses 30 and 24 or something like that. So I have input
sources at 15 fps that get converted to 30 or 24 fps that get converted to
30. The end result, I think, is that frames are being doubled to get the
fps, which makes video play slower than the audio. It also gets worse and
worse (sync) as the concatenated video progresses. Can anybody help me
here? I read something about using -vsync with -map so I can sync the
video
to the audio by dropping or adding frames. Here are all the commands I
use
in this process. Thanks for the input. They are labeled $one ... $n in
the
order that I call the commands from php exec(). A couple things I've
tried
lately... On $one and $two I have toggeled the use of -r 30 for the input
file. On $twelve I have tried to convert back to -r 15 in hopes it would
re-sync.
$one = "ffmpeg -y -r 30 -i ./files/11684546964708514650724.82824test2.mov
-s
400x300 -vcodec mpeg1video -acodec mp2 -r 30 ./downloads/OvSOne.mpg";
$two = "ffmpeg -y -r 30 -i
./files/1168466060313378706743.940711play_mayer_life.mp4 -s 400x300
-vcodec
mpeg1video -acodec mp2 -r 30 ./downloads/OvSTwo.mpg";
Stop right here. Do these 2 mpg's have correct A/V sync? If not, then
concatenation is hopeless - my point along the whole thread has been
that concatenation works well *only* if the timestamps are correct. And
better post the command output for these 2.
It is totally hopeless to debug a sequence of 12 commands by considering
just the final stage. The files have to be validated at every stage.
The audio and video don't lose sync until I concatenate them into one file
at the end. When I initially change them to mpgs eg $one and $two from
above, the files play just fine.
Output from $one.
FFmpeg version SVN-r7231, Copyright (c) 2000-2006 Fabrice Bellard, et al.
configuration: --prefix=/usr --mandir=${prefix}/share/man --enable-gpl
--enable-pp --enable-pthreads --enable-vorbis --enable-libogg --enable-a52
--enable-dts --enable-libgsm --disable-debug --enable-mp3lame --enable-faad
libavutil version: 49.1.0
libavcodec version: 51.25.0
libavformat version: 51.6.0
built on Dec 7 2006 15:18:07, gcc: 3.3.5 (Debian 1:3.3.5-13)
Seems that stream 0 comes from film source: 3000.00 (90000/30) -> 15.00
(15/1)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from
Duration: 00:00:04.2, start: 0.000000, bitrate: 172 kb/s
Stream #0.0(eng): Video: h264, yuv420p, 320x240, 15.00 fps(r)
Stream #0.1(eng): Audio: aac, 44100 Hz, stereo
Stream #0.0: Video: mpeg1video, yuv420p, 400x300, q=2-31, 200 kb/s, 30.00
fps(c)
Stream #0.1: Audio: mp2, 44100 Hz, stereo, 64 kb/s
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1
Press [q] to stop encoding
frame= 126 q=2.8 Lsize= 254kB time=4.0 bitrate= 513.9kbits/s
video:40kB audio:32kB global headers:0kB muxing overhead 255.550695%
Output from $two
FFmpeg version SVN-r7231, Copyright (c) 2000-2006 Fabrice Bellard, et al.
configuration: --prefix=/usr --mandir=${prefix}/share/man --enable-gpl
--enable-pp --enable-pthreads --enable-vorbis --enable-libogg --enable-a52
--enable-dts --enable-libgsm --disable-debug --enable-mp3lame --enable-faad
libavutil version: 49.1.0
libavcodec version: 51.25.0
libavformat version: 51.6.0
built on Dec 7 2006 15:18:07, gcc: 3.3.5 (Debian 1:3.3.5-13)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from
Duration: 00:03:37.9, start: 0.000000, bitrate: 344 kb/s
Stream #0.0(und): Video: h264, yuv420p, 320x240, 15.00 fps(r)
Stream #0.1(und): Audio: aac, 44100 Hz, stereo
Stream #0.0: Video: mpeg1video, yuv420p, 400x300, q=2-31, 200 kb/s, 30.00
fps(c)
Stream #0.1: Audio: mp2, 44100 Hz, stereo, 64 kb/s
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1
Press [q] to stop encoding
frame= 6536 q=2.2 Lsize= 7248kB time=217.8 bitrate= 272.7kbits/s
video:361kB audio:1701kB global headers:0kB muxing overhead 251.416185%
Michel Bardiaux
2007-01-17 11:32:36 UTC
Permalink
Josh Millstein wrote:
[snip]
Post by Josh Millstein
Post by Josh Millstein
$one = "ffmpeg -y -r 30 -i ./files/11684546964708514650724.82824test2.mov
-s
400x300 -vcodec mpeg1video -acodec mp2 -r 30 ./downloads/OvSOne.mpg";
$two = "ffmpeg -y -r 30 -i
./files/1168466060313378706743.940711play_mayer_life.mp4 -s 400x300
-vcodec
mpeg1video -acodec mp2 -r 30 ./downloads/OvSTwo.mpg";
[snip]
Post by Josh Millstein
Output from $one.
FFmpeg version SVN-r7231, Copyright (c) 2000-2006 Fabrice Bellard, et al.
configuration: --prefix=/usr --mandir=${prefix}/share/man --enable-gpl
--enable-pp --enable-pthreads --enable-vorbis --enable-libogg --enable-a52
--enable-dts --enable-libgsm --disable-debug --enable-mp3lame --enable-faad
libavutil version: 49.1.0
libavcodec version: 51.25.0
libavformat version: 51.6.0
built on Dec 7 2006 15:18:07, gcc: 3.3.5 (Debian 1:3.3.5-13)
Seems that stream 0 comes from film source: 3000.00 (90000/30) -> 15.00
(15/1)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from
Duration: 00:00:04.2, start: 0.000000, bitrate: 172 kb/s
Stream #0.0(eng): Video: h264, yuv420p, 320x240, 15.00 fps(r)
Stream #0.1(eng): Audio: aac, 44100 Hz, stereo
Stream #0.0: Video: mpeg1video, yuv420p, 400x300, q=2-31, 200 kb/s, 30.00
fps(c)
Stream #0.1: Audio: mp2, 44100 Hz, stereo, 64 kb/s
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1
Press [q] to stop encoding
frame= 126 q=2.8 Lsize= 254kB time=4.0 bitrate= 513.9kbits/s
video:40kB audio:32kB global headers:0kB muxing overhead 255.550695%
Output from $two
FFmpeg version SVN-r7231, Copyright (c) 2000-2006 Fabrice Bellard, et al.
configuration: --prefix=/usr --mandir=${prefix}/share/man --enable-gpl
--enable-pp --enable-pthreads --enable-vorbis --enable-libogg --enable-a52
--enable-dts --enable-libgsm --disable-debug --enable-mp3lame --enable-faad
libavutil version: 49.1.0
libavcodec version: 51.25.0
libavformat version: 51.6.0
built on Dec 7 2006 15:18:07, gcc: 3.3.5 (Debian 1:3.3.5-13)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from
Duration: 00:03:37.9, start: 0.000000, bitrate: 344 kb/s
Stream #0.0(und): Video: h264, yuv420p, 320x240, 15.00 fps(r)
Stream #0.1(und): Audio: aac, 44100 Hz, stereo
Stream #0.0: Video: mpeg1video, yuv420p, 400x300, q=2-31, 200 kb/s, 30.00
fps(c)
Stream #0.1: Audio: mp2, 44100 Hz, stereo, 64 kb/s
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1
Press [q] to stop encoding
frame= 6536 q=2.2 Lsize= 7248kB time=217.8 bitrate= 272.7kbits/s
video:361kB audio:1701kB global headers:0kB muxing overhead 251.416185%
Josh Millstein
2007-01-17 18:31:58 UTC
Permalink
Post by Michel Bardiaux
[snip]
Post by Josh Millstein
Post by Josh Millstein
$one = "ffmpeg -y -r 30 -i
./files/11684546964708514650724.82824test2.mov
-s
400x300 -vcodec mpeg1video -acodec mp2 -r 30 ./downloads/OvSOne.mpg";
$two = "ffmpeg -y -r 30 -i
./files/1168466060313378706743.940711play_mayer_life.mp4 -s 400x300
-vcodec
mpeg1video -acodec mp2 -r 30 ./downloads/OvSTwo.mpg";
[snip]
Post by Josh Millstein
Output from $one.
FFmpeg version SVN-r7231, Copyright (c) 2000-2006 Fabrice Bellard, et al.
configuration: --prefix=/usr --mandir=${prefix}/share/man --enable-gpl
--enable-pp --enable-pthreads --enable-vorbis --enable-libogg --enable-a52
--enable-dts --enable-libgsm --disable-debug --enable-mp3lame --enable-faad
libavutil version: 49.1.0
libavcodec version: 51.25.0
libavformat version: 51.6.0
built on Dec 7 2006 15:18:07, gcc: 3.3.5 (Debian 1:3.3.5-13)
Seems that stream 0 comes from film source: 3000.00 (90000/30) -> 15.00
(15/1)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from
Duration: 00:00:04.2, start: 0.000000, bitrate: 172 kb/s
Stream #0.0(eng): Video: h264, yuv420p, 320x240, 15.00 fps(r)
Stream #0.1(eng): Audio: aac, 44100 Hz, stereo
Stream #0.0: Video: mpeg1video, yuv420p, 400x300, q=2-31, 200 kb/s, 30.00
fps(c)
Stream #0.1: Audio: mp2, 44100 Hz, stereo, 64 kb/s
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1
Press [q] to stop encoding
frame= 126 q=2.8 Lsize= 254kB time=4.0 bitrate= 513.9kbits/s
video:40kB audio:32kB global headers:0kB muxing overhead 255.550695%
Output from $two
FFmpeg version SVN-r7231, Copyright (c) 2000-2006 Fabrice Bellard, et al.
configuration: --prefix=/usr --mandir=${prefix}/share/man --enable-gpl
--enable-pp --enable-pthreads --enable-vorbis --enable-libogg --enable-a52
--enable-dts --enable-libgsm --disable-debug --enable-mp3lame --enable-faad
libavutil version: 49.1.0
libavcodec version: 51.25.0
libavformat version: 51.6.0
built on Dec 7 2006 15:18:07, gcc: 3.3.5 (Debian 1:3.3.5-13)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from
Duration: 00:03:37.9, start: 0.000000, bitrate: 344 kb/s
Stream #0.0(und): Video: h264, yuv420p, 320x240, 15.00 fps(r)
Stream #0.1(und): Audio: aac, 44100 Hz, stereo
Stream #0.0: Video: mpeg1video, yuv420p, 400x300, q=2-31, 200 kb/s, 30.00
fps(c)
Stream #0.1: Audio: mp2, 44100 Hz, stereo, 64 kb/s
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1
Press [q] to stop encoding
frame= 6536 q=2.2 Lsize= 7248kB time=217.8 bitrate= 272.7kbits/s
video:361kB audio:1701kB global headers:0kB muxing overhead 251.416185%
Michel Bardiaux
2007-01-18 09:29:17 UTC
Permalink
Well it did what you did and it worked for me as well. I think it was
working all along, but the way my browser played the file was all screwy.
I learned that the hard way too: media players are geared to play *most*
files, even seriously corrupted ones; to do that they take many
initiatives, about which they dont tell you! So, you cant believe what
just one player tells you, you have to try files in many players, and if
you observe the same weirdnesses, then chances are they are in the file.

Greetings,
--
Michel Bardiaux
R&D Director
T +32 [0] 2 790 29 41
F +32 [0] 2 790 29 02
E mailto:mbardiaux at mediaxim.be

Mediaxim NV/SA
Vorstlaan 191 Boulevard du Souverain
Brussel 1160 Bruxelles
http://www.mediaxim.com/
Loading...