Audio/video stream recording forums (http://stream-recorder.com/forum/index.php)
-   Video stream recording (http://stream-recorder.com/forum/forumdisplay.php?f=4)
-   -  

For the pros: Different length in audio- and file of the same stream

(http://stream-recorder.com/forum/showthread.php?t=11279)

sebastian 03-19-2012 02:42 PM

For the pros: Different length in audio- and file of the same stream


 
Hi guys,

when downloading and merging the video files of be-at.tv (e.g. hxxp://www.be-at.tv/brands/wmc/surfcomber/waveform-with-victor-calderone-guests/ida-engberg.go ), the video and audio file (which are splitted) do have different lengths.

In my shown example, the downloaded mp3 is 01:28:36, but the video is 01:28:49! Also the video slider at the website itself shows 2nd length.

So how can I get the video and audio in sync? And what is the master lenght?

I guess this is a question for the pros. ;-)

Thanks in advance!

Bahman 03-19-2012 04:41 PM

Re: For the pros: Different length in audio- and file of the same stream


 
2nd one is master length, for sure!!
Avidemux can do this trick(sync) I think without re-encoding!!

sebastian 04-13-2012 01:22 PM

Re: For the pros: Different length in audio- and file of the same stream


 
Quote:

Originally Posted by Bahman (Post 42220)
2nd one is master length, for sure!!
Avidemux can do this trick(sync) I think without re-encoding!!

Ok, and do you know how?

svnpenn 04-13-2012 04:14 PM

Re: For the pros: Different length in audio- and file of the same stream


 
Just use FFmpeg

Code:

ffmpeg -i video.flv -i audio.mp3 -c copy out.flv

greenythebeast 04-13-2012 04:29 PM

Re: For the pros: Different length in audio- and file of the same stream


 
What codec is the audio?

svnpenn 04-13-2012 04:39 PM

Re: For the pros: Different length in audio- and file of the same stream


 
Quote:

Originally Posted by greenythebeast (Post 43375)
What codec is the audio?

Quote:

In my shown example, the downloaded mp3
​​​​​

greenythebeast 04-13-2012 04:48 PM

Re: For the pros: Different length in audio- and file of the same stream


 
Quote:

Originally Posted by svnpenn (Post 43377)
​​​​​

ah, i see. when using ffmpeg try adding "-async 1" without the quotes.

sebastian 04-14-2012 07:46 AM

Re: For the pros: Different length in audio- and file of the same stream


 
Okay, so this is the solution?

Code:

ffmpeg -i video.flv -i audio.mp3 -c copy out.flv -async 1
My 2nd question is: Is there also a solution for first demuxing the video? I muxed them with mencoder.exe.

Now I'd like to write a batch file, that first splits the audio and video, and after that muxes it again via the code you told me.

svnpenn 04-14-2012 12:55 PM

Re: For the pros: Different length in audio- and file of the same stream


 
You should be able to just "remux" the file.

Say you have a file with 1 video stream and 1 audio stream. You can do

Code:

ffmpeg -i bad-video.flv -c copy good-video.flv
If indeed you need to do it in 2 steps you can do this

Code:

ffmpeg -i bad-video.flv -map a -c copy astream.mp3
ffmpeg -i bad-video.flv -map v -c copy vstream.flv
ffmpeg -i vstream.flv -i astream.mp3 -c copy good-video.flv


sebastian 04-15-2012 09:31 AM

Re: For the pros: Different length in audio- and file of the same stream


 
Okay, but I'd have to add -async 1? Like
Code:

ffmpeg -i bad-video.flv -c copy good-video.flv -async 1
?

svnpenn 04-15-2012 11:32 AM

Re: For the pros: Different length in audio- and file of the same stream


 
Ok this is what I did

PAGE
be-at.tv/brands/wmc/surfcomber/waveform-with-victor-calderone-guests/ida-engberg

GET AUDIO
Code:

rtmpdump \
-r rtmp://media.cdn.be-at.tv \
-a cfx/st \
-W http://www.be-at.tv/v2/2/7/HostMovie.swf \
-y Session001216/Audio001284/128 \
-o Audio001284.flv

GET VIDEO
DownThemAll, Batch Download
Code:

video.cdn.be-at.tv/Session001216/Video002677/1000.[000:100].flv
MERGE
Merge videos with Avidemux, then combine with audio
Code:

ffmpeg -i 1000.000-100.flv -i Audio001284.flv -c copy video-audio.flv

sebastian 04-22-2012 09:31 AM

Re: For the pros: Different length in audio- and file of the same stream


 
Thanks a lot guys, am going to try this!

sebastian 06-05-2012 12:54 PM

Re: For the pros: Different length in audio- and file of the same stream


 
One other question: How can I append multiple files in AviDemux? Append 100 files one after one is very difficult. ;-)

svnpenn 06-05-2012 11:13 PM

Re: For the pros: Different length in audio- and file of the same stream


 
Quote:

Originally Posted by sebastian (Post 47165)
One other question: How can I append multiple files in AviDemux? Append 100 files one after one is very difficult. ;-)

Just highlight all of them and drag to the program; thats what I did.

sebastian 06-06-2012 10:12 AM

Re: For the pros: Different length in audio- and file of the same stream


 
That works, thanks! And I can be sure, that AviDemux will add it in the right order (alphabetically)?

svnpenn 06-06-2012 12:58 PM

Re: For the pros: Different length in audio- and file of the same stream


 
Quote:

Originally Posted by sebastian (Post 47207)
That works, thanks! And I can be sure, that AviDemux will add it in the right order (alphabetically)?

Should do :)

sebastian 06-07-2012 10:02 AM

Re: For the pros: Different length in audio- and file of the same stream


 
Okay I see the problem of be-at.tv now:

The videostream is missing frames every now and then. So if I use a constant frame rate, the video will always be shorter than the audiostream. I figured it out when I saw, that sometimes my downloaded video is getting slower and faster.

When watching the video via the website, the video get's resynced to the audio every few seconds.

So, right now it's turning out into the pro-question ;) : How can I merge the video-chunks AND have it synced to the audio?

sebastian 06-08-2012 05:42 AM

Re: For the pros: Different length in audio- and file of the same stream


 
Alternatively, is there a way to stretch the video via its framerate, so that it fits the audio length?

sebastian 06-08-2012 01:35 PM

Re: For the pros: Different length in audio- and file of the same stream


 
My 2nd question is answered with the following string, which syncs the video to the audiostream:

Code:

ffmpeg -i video.flv -vsync drop -i audio.flv -c copy video-audio.flv -map 1:1
If anyone does have a better solution, please help me. :-)


EDIT: That didn't help. It only changed the length of the videoindex, not the framerate. :-(


All times are GMT -6. The time now is 06:45 PM.