audio video not syncing

Questions involving a Windows version of FFmpeg.
Post Reply
resac
Posts: 4
Joined: Mon Nov 19, 2018 4:43 am

audio video not syncing

Post by resac » Sat Jan 05, 2019 5:55 pm

Hi All,

i am using below command to trans-code h264 to mpeg2video. but audio video is not matching. below is the command which i am using.

ffmpeg -re -i udp://224.2.2.8:1008 -map 0:p:40 -vcodec mpeg2video -s 720x576 -r 25 -flags cgop+ilme -sc_threshold 1000000000 -b:v 2M -minrate:v 2M -maxrate:v 2M -bufsize:v 1.4M -acodec mp2 -ac 2 -b:a 192k -f mpegts udp://230.0.0.5:1008?pkt_size=1316


anyone suggest how to handle this.

roderrooder
Posts: 62
Joined: Tue Jan 02, 2018 10:41 am

Re: audio video not syncing

Post by roderrooder » Wed Jan 09, 2019 9:56 pm

Is the audio ahead or behind the video?

resac
Posts: 4
Joined: Mon Nov 19, 2018 4:43 am

Re: audio video not syncing

Post by resac » Fri Jan 11, 2019 5:17 pm

audio is ahead, and video is behind. but sometimes its works normally. maximum time its like audio ahead and video is behind.

roderrooder
Posts: 62
Joined: Tue Jan 02, 2018 10:41 am

Re: audio video not syncing

Post by roderrooder » Mon Jan 14, 2019 6:00 pm

You'll probably just have to go with using adelay:

Code: Select all

ffmpeg -re -i udp://224.2.2.8:1008 -map 0:p:40 -vcodec mpeg2video -s 720x576 -r 25 -flags cgop+ilme -sc_threshold 1000000000 -b:v 2M 
-minrate:v 2M -maxrate:v 2M -bufsize:v 1.4M -acodec mp2 -ac 2 -b:a 192k -af "adelay=0|0"-f mpegts udp://230.0.0.5:1008?pkt_size=1316
This will delay the audio where 0 is milliseconds, the number before the bar represents the left channel and after the bar the right. If the source is Mono remove the bar.

Because "sometimes its works normally" you'll just have to use an amount of delay that gets you mostly there in both scenarios, without consistency you will never be able to perfect it, unless you choose to synchronize after the face every time.

resac
Posts: 4
Joined: Mon Nov 19, 2018 4:43 am

Re: audio video not syncing

Post by resac » Tue Jan 15, 2019 5:44 pm

Hi,

i just removed the -re from the code and everything working fine. i just didn't get why that happening in -re command. if get explanation it will help me to understand my mistake.

roderrooder
Posts: 62
Joined: Tue Jan 02, 2018 10:41 am

Re: audio video not syncing

Post by roderrooder » Fri Jan 18, 2019 10:16 pm


resac
Posts: 4
Joined: Mon Nov 19, 2018 4:43 am

Re: audio video not syncing

Post by resac » Mon Jan 21, 2019 9:46 am

thanks,


one question i have the metadata like (PAT,PMT,SDT all with udp stream) with the iput file, how can copy same metatadata and map with the channels?? is there any documentation???

roderrooder
Posts: 62
Joined: Tue Jan 02, 2018 10:41 am

Re: audio video not syncing

Post by roderrooder » Wed Jan 23, 2019 9:57 pm

You should be able to use -map_metadata:
Image

All documentation can be found via this link:
https://www.ffmpeg.org/ffmpeg-all.html

Post Reply