[FFmpeg-user] Problem remuxing corrupted HLS-stream

Henk D. Schoneveld belcampo at zonnet.nl
Tue Jan 28 16:29:51 CET 2014


In HLS-segmented files each chunk has info, timing info about the former chunk. If  the former chunk is missing, yes then what.
If you extract the video and audio parts as elementary streams, without timing info, these elementary streams can be catted together and put in a fly or other container again.

On 28 Jan 2014, at 13:04, Vadim Lazovskiy <vadim.lazovskiy at gmail.com> wrote:

> Using 'concat' demuxer as workaround for this problem:
> 
> conv01:~ # grep '.ts' stream.m3u8 | sed -r 's/.*/file \0/g' | ffmpeg -f
> concat -i - -codec:v copy -y /tmp/out.flv
> ffmpeg version 2.1.1 Copyright (c) 2000-2013 the FFmpeg developers
>  built on Nov  8 2013 10:57:47 with gcc 4.8 (SUSE Linux)
>  configuration: --shlibdir=/usr/lib64 --prefix=/usr
> --mandir=/usr/share/man --libdir=/usr/lib64 --enable-shared
> --disable-static --enable-debug --disable-stripping --extra-cflags='-O2 -g
> -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector
> -funwind-tables -fasynchronous-unwind-tables -fPIC -I/usr/include/gsm'
> --enable-gpl --enable-x11grab --enable-version3 --enable-pthreads
> --enable-libfaac --enable-libfdk_aac --enable-nonfree --enable-avfilter
> --enable-libpulse --enable-libvpx --enable-libopus --enable-libass
> --enable-libmp3lame --enable-libvorbis --enable-libtheora --enable-libspeex
> --enable-libxvid --enable-libx264 --enable-libschroedinger --enable-libgsm
> --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-postproc
> --enable-libdc1394 --enable-librtmp --enable-libfreetype
> --enable-avresample --enable-libtwolame --enable-libvo-aacenc
> --enable-gnutls
>  libavutil      52. 48.101 / 52. 48.101
>  libavcodec     55. 39.101 / 55. 39.101
>  libavformat    55. 19.104 / 55. 19.104
>  libavdevice    55.  5.100 / 55.  5.100
>  libavfilter     3. 90.100 /  3. 90.100
>  libavresample   1.  1.  0 /  1.  1.  0
>  libswscale      2.  5.101 /  2.  5.101
>  libswresample   0. 17.104 /  0. 17.104
>  libpostproc    52.  3.100 / 52.  3.100
> Input #0, concat, from 'pipe:':
>  Duration: N/A, start: 0.000000, bitrate: N/A
>    Stream #0:0: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(tv,
> bt709), 1280x720, 25 fps, 25 tbr, 90k tbn, 50 tbc
> Output #0, flv, to '/tmp/out.flv':
>  Metadata:
>    encoder         : Lavf55.19.104
>    Stream #0:0: Video: h264 ([7][0][0][0] / 0x0007), yuv420p, 1280x720,
> q=2-31, 25 fps, 1k tbn, 90k tbc
> Stream mapping:
>  Stream #0:0 -> #0:0 (copy)
> [mpegts @ 0x1bc5880] DTS discontinuity in stream 0: packet 6 with DTS 6,
> packet 7 with DTS 3600
> frame= 2577 fps=0.0 q=-1.0 Lsize=   25320kB time=00:01:42.40
> bitrate=2025.5kbits/s
> video:25269kB audio:0kB subtitle:0 global headers:0kB muxing overhead
> 0.200305%
> 
> As for the standard hls input format, seems it doesn't support PTS
> adjusting. Perhaps it is not supposed to.
> 
> 
> 
> 2014-01-27 Vadim Lazovskiy <vadim.lazovskiy at gmail.com>
> 
>> Thank you for reply!
>> 
>> Here is the command and the output. This is the one I needed and expected
>> to work.
>> Please, note the resulting duration.
>> http://pastebin.com/mCfcLf3W
>> 
>> The same command with increased verbosity:
>> http://pastebin.com/Hy0qdnGX
>> 
>> This log entries seems to be meaningful:
>> 
>> 
>>   1. [mpegts @ 0x75fd80] Continuity check failed for pid 17 expected 5
>>   got 0
>>   2. [mpegts @ 0x75fd80] Continuity check failed for pid 0 expected 7
>>   got 0
>>   3. [mpegts @ 0x75fd80] Continuity check failed for pid 4096 expected 7
>>   got 0
>>   4. [mpegts @ 0x75fd80] Continuity check failed for pid 256 expected 13
>>   got 0
>> 
>> 
>> Buy using this command I've managed to fix the issue with output file
>> duration:
>> http://pastebin.com/axAhmcPg
>> 
>> But in this case full transcoding was performed.
>> 
>> I'd like to know if there is non-CPU-related solution to compose single
>> video file from such HLS stream.
>> 
>> 
>> 2014-01-26 Carl Eugen Hoyos <cehoyos at ag.or.at>
>> 
>> Vadim Lazovskiy <vadim.lazovskiy <at> gmail.com> writes:
>>> 
>>>> Here is the ffmpeg output cut:
>>> 
>>> If you ask for support on this mailing list, please
>>> always provide your command line together with the
>>> complete, uncut console output, do not cut the
>>> start of the output.
>>> 
>>> Carl Eugen
>>> 
>>> _______________________________________________
>>> ffmpeg-user mailing list
>>> ffmpeg-user at ffmpeg.org
>>> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>>> 
>> 
>> 
>> 
>> --
>> Best Regards,
>> Vadim Lazovskiy
>> 
> 
> 
> 
> -- 
> Best Regards,
> Vadim Lazovskiy
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user



More information about the ffmpeg-user mailing list