Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Leading silence (gaps) in audio segments #15

Open
litchfield opened this issue Sep 27, 2011 · 13 comments
Open

Leading silence (gaps) in audio segments #15

litchfield opened this issue Sep 27, 2011 · 13 comments

Comments

@litchfield
Copy link

I'm seeing gaps (silence) at the beginning of each audio segment.

Segment 1 = no gap,
Segment 2 = 1s gap,
Segment 3 = 2s gap,
Segment 4 = 3s gap,
... and so on.

This causes gaps/pops/clicks in playback.

Both mediastreamsegmenter and mediafilesegmenter are all fine (no gaps) on same source file (libfaac mpegts via ffmpeg).

All tests are using same default segment duration 10s.

@litchfield
Copy link
Author

FFmpeg version 0.6.2

@ghost
Copy link

ghost commented Oct 22, 2011

Can you post a small sample from the input file you are using? Or does it happen on all files?

@litchfield
Copy link
Author

Here's the command I use to process them --

    ffmpeg -y -i "%(source)s" -acodec libfaac -vn -ab 64k -ac 1 -f mpegts - | \
    m3u8-segmenter -i - -d 10 -p fanchants-free -m fanchants-free.m3u8 -u %(target_urldir)s \

@ghost
Copy link

ghost commented Oct 25, 2011

Thanks I'll take a look at these

@ghost
Copy link

ghost commented Oct 25, 2011

Hmm. Interestingly enough the m3u8 loop plays fine under mplayer for me, but when I stream it to the iPhone I do get the popping and clicking.

@litchfield
Copy link
Author

Weird huh, now try opening the ts files in an editor (eg Audacity) and you'll see the gaps

@ghost
Copy link

ghost commented Oct 25, 2011

Out of interest, does the same problem occur if you retain both channels (-ac 2) when converting to aac ?

@litchfield
Copy link
Author

Yep, same problem -ac 1 vs -ac 2.

Also tried --

  • Both libfaac and aac (ffmpeg experimental version)
  • Various segment lengths, same problem
  • Various bit rates
  • From file instead of from stdin

@ghost
Copy link

ghost commented Oct 29, 2011

My command line is this (ffmpeg 0.8.5.git-751a4e):

ffmpeg -i http://stream-tx1.radioparadise.com:9000/rp_192.ogg -f mpegts -acodec libfaac -ab 128000 -| ../m3u8-segmenter/m3u8-segmenter -i - -d 1 -p media -m index.m3u8 -u http://localhost/aac/ -n 60

In addition to the pops and clicks, the program segfaults after starting the 49th file:

  Abort trap: 6kB time=00:00:48.83 bitrate= 143.4kbits/s 

I'm looking into the problem, but I'm just a first year :)

@D0023R
Copy link

D0023R commented Nov 23, 2011

Hi,

The gaps might be introduced with the header added to each segment. The following patch fix it:

--- m3u8-segmenter.c_ori 2011-11-23 10:39:17.000000000 +0100
+++ m3u8-segmenter.c 2011-11-23 10:39:41.000000000 +0100
@@ -469,11 +469,13 @@
break;
}

+if(0) {
// Write a new header at the start of each file
if (avformat_write_header(oc, NULL)) {
fprintf(stderr, "Could not write mpegts header to first output file\n");
exit(1);
}
+}

         prev_segment_time = segment_time;
     }

Rgds

Alex

@ghost
Copy link

ghost commented Nov 25, 2011

That works! Thanks a bunch!

@litchfield
Copy link
Author

Bradskins- we ended up taking your tip and using httpsegmenter instead- thanks- it still seems to include the silence but the pops/clicks were gone.

Will check out this patch at some point as we'd prefer no gaps at all (even if u can't hear em)

@ghost
Copy link

ghost commented Nov 29, 2011

After applying the patch I ended up using both :). httpsegmenter is good
for streaming and m3u8-segmenter is good for encoding static files. One
thing I've noticed none of them do well: support for relative paths instead
of full URLs. It's entirely possible to use ./media-1.ts, ./media-2.ts in
your m3u8 file instead of putting the whole URL. I'll probably mention
something to both projects soon.

Regards,

-brad

On Mon, Nov 28, 2011 at 9:14 PM, s29 <
reply@reply.github.com

wrote:

Bradskins- we ended up taking your tip and using httpsegmenter instead-
thanks- it still seems to include the silence but the pops/clicks were gone.

Will check out this patch at some point as we'd prefer no gaps at all
(even if u can't hear em)


Reply to this email directly or view it on GitHub:
#15 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants