V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
shitbreak
V2EX  ›  FFmpeg

ffmpeg 录制流媒体 卡住

  •  
  •   shitbreak · 2020-06-17 23:03:31 +08:00 · 3607 次点击
    这是一个创建于 1617 天前的主题,其中的信息可能已经有所发展或是发生改变。

    http://fash1043.cloudycdn.services/slive/definst/ftv_midnite_secrets_adaptive.smil/chunklist_b4700000_t64MTA4MHA=.m3u8

    各位大佬,谁能流畅播放这个 m3u8,试过好几只鸡 ffmpeg 录制不超过 3 分钟中途 404 退出,估计速度跟不上,请提供思路。

    $ ffmpeg -t 3600 -i 'http://fash1043.cloudycdn.services/slive/_definst_/ftv_midnite_secrets_adaptive.smil/chunklist_b4700000_t64MTA4MHA=.m3u8' -c:v copy -c:a copy -bsf:a aac_adtstoasc ./test8.mp4
    ffmpeg version 2.6.9 Copyright (c) 2000-2016 the FFmpeg developers
      built with gcc 4.9.2 (Debian 4.9.2-10+deb8u1)
      configuration: --prefix=/usr --extra-cflags='-g -O2 -fstack-protector-strong -Wformat -Werror=format-security ' --extra-ldflags='-Wl,-z,relro' --enable-shared --enable-libmp3lame --enable-gpl --enable-nonfree --enable-libvorbis --enable-pthreads --enable-libfaac --enable-libxvid --enable-postproc --enable-x11grab --enable-libgsm --enable-libtheora --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-libspeex --enable-nonfree --disable-stripping --enable-libvpx --enable-libschroedinger --disable-encoder=libschroedinger --enable-version3 --enable-libopenjpeg --enable-librtmp --enable-avfilter --enable-libfreetype --enable-libvo-aacenc --disable-decoder=amrnb --enable-libvo-amrwbenc --enable-libaacplus --libdir=/usr/lib/x86_64-linux-gnu --disable-vda --enable-libbluray --enable-libcdio --enable-gnutls --enable-frei0r --enable-openssl --enable-libass --enable-libopus --enable-fontconfig --enable-libpulse --disable-mips32r2 --disable-mipsdspr1 --disable-mipsdspr2 --enable-libvidstab --enable-libzvbi --enable-avresample --disable-htmlpages --disable-podpages --enable-libutvideo --enable-libfdk-aac --enable-libx265 --enable-libiec61883 --enable-vaapi --enable-libdc1394 --disable-altivec --shlibdir=/usr/lib/x86_64-linux-gnu
      libavutil      54. 20.100 / 54. 20.100
      libavcodec     56. 26.100 / 56. 26.100
      libavformat    56. 25.101 / 56. 25.101
      libavdevice    56.  4.100 / 56.  4.100
      libavfilter     5. 11.102 /  5. 11.102
      libavresample   2.  1.  0 /  2.  1.  0
      libswscale      3.  1.101 /  3.  1.101
      libswresample   1.  1.100 /  1.  1.100
      libpostproc    53.  3.100 / 53.  3.100
    Input #0, hls,applehttp, from 'http://fash1043.cloudycdn.services/slive/_definst_/ftv_midnite_secrets_adaptive.smil/chunklist_b4700000_t64MTA4MHA=.m3u8':
      Duration: N/A, start: 13668.124356, bitrate: N/A
      Program 0 
        Metadata:
          variant_bitrate : 0
        Stream #0:0: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
        Stream #0:1: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 141 kb/s
    File './test8.mp4' already exists. Overwrite ? [y/N] y
    Output #0, mp4, to './test8.mp4':
      Metadata:
        encoder         : Lavf56.25.101
        Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 25 fps, 25 tbr, 90k tbn, 90k tbc
        Stream #0:1: Audio: aac ([64][0][0][0] / 0x0040), 48000 Hz, stereo, 141 kb/s
    Stream mapping:
      Stream #0:0 -> #0:0 (copy)
      Stream #0:1 -> #0:1 (copy)
    Press [q] to stop, [?] for help
    frame=  154 fps=0.0 q=-1.0 size=    2759kB time=00:00:06.08 bitrate=3714.0kbitsframe=  184 fps=171 q=-1.0 size=    3271kB time=00:00:07.30 bitrate=3670.2kbitsframe=  274 fps=173 q=-1.0 size=    4998kB time=00:00:10.88 bitrate=3761.7kbitsframe=  304 fps=142 q=-1.0 size=    5486kB time=00:00:12.10 bitrate=3714.0kbitsframe=  338 fps=128 q=-1.0 size=    6194kB time=00:00:13.44 bitrate=3774.2kbitsframe=  449 fps=110 q=-1.0 size=    8476kB time=00:00:17.94 bitrate=3868.8kbitsframe=  459 fps=100 q=-1.0 size=    8675kB time=00:00:18.35 bitrate=3872.2kbitsframe=  534 fps=104 q=-1.0 size=   10036kB time=00:00:21.33 bitrate=3852.6kbitsframe=  597 fps= 57 q=-1.0 size=   11197kB time=00:00:23.89 bitrate=3838.0kbitsframe=  636 fps= 57 q=-1.0 size=   11838kB time=00:00:25.45 bitrate=3809.5kbitsframe=  749 fps= 63 q=-1.0 size=   14231kB time=00:00:29.97 bitrate=3888.7kbitsframe=  760 fps= 61 q=-1.0 size=   14441kB time=00:00:30.36 bitrate=3896.0kbitsframe=  848 fps= 66 q=-1.0 size=   15929kB time=00:00:33.90 bitrate=3848.6kbitsframe=  903 fps= 54 q=-1.0 size=   17014kB time=00:00:36.12 bitrate=3858.3kbitsframe=  923 fps= 53 q=-1.0 size=   17429kB time=00:00:36.91 bitrate=3867.9kbitsframe=  989 fps= 55 q=-1.0 size=   18792kB time=00:00:39.57 bitrate=3889.5kbitsframe= 1053 fps= 39 q=-1.0 size=   20066kB time=00:00:42.13 bitrate=3900.8kbitsframe= 1069 fps= 39 q=-1.0 size=   20327kB time=00:00:42.77 bitrate=3892.4kbitsframe= 1147 fps= 41 q=-1.0 size=   21713kB time=00:00:45.93 bitrate=3872.2kbitsframe= 1202 fps= 36 q=-1.0 size=   22787kB time=00:00:48.09 bitrate=3881.5kbitsframe= 1229 fps= 37 q=-1.0 size=   23237kB time=00:00:49.20 bitrate=3868.9kbitsframe= 1312 fps= 39 q=-1.0 size=   24718kB time=00:00:52.52 bitrate=3854.9kbitsframe= 1354 fps= 34 q=-1.0 size=   25741kB time=00:00:54.17 bitrate=3892.7kbitsframe= 1378 fps= 35 q=-1.0 size=   26061kB time=00:00:55.15 bitrate=3870.9kbitsframe= 1431 fps= 35 q=-1.0 size=   27072kB time=00:00:57.24 bitrate=3874.2kbitsframe= 1490 fps= 36 q=-1.0 size=   28066kB time=00:00:59.65 bitrate=3854.2kbitsframe= 1498 fps= 33 q=-1.0 size=   28295kB time=00:00:59.93 bitrate=3867.7kbitsframe= 1525 fps= 33 q=-1.0 size=   28796kB time=00:01:01.04 bitrate=3864.6kbitsframe= 1594 fps= 34 q=-1.0 size=   30200kB time=00:01:03.79 bitrate=3878.2kbitsframe= 1652 fps= 32 q=-1.0 size=   31359kB time=00:01:06.13 bitrate=3884.0kbitsframe= 1695 fps= 32 q=-1.0 size=   32269kB time=00:01:07.80 bitrate=3898.8kbitsframe= 1801 fps= 31 q=-1.0 size=   34276kB time=00:01:12.09 bitrate=3894.8kbitsframe= 1824 fps= 31 q=-1.0 size=   34737kB time=00:01:13.00 bitrate=3897.7kbitsframe= 1850 fps= 31 q=-1.0 size=   35257kB time=00:01:14.03 bitrate=3901.3kbitsframe= 1883 fps= 32 q=-1.0 size=   35832kB time=00:01:15.39 bitrate=3893.1kbitsframe= 1917 fps= 32 q=-1.0 size=   36477kB time=00:01:16.69 bitrate=3895.9kbitsframe= 1950 fps= 30 q=-1.0 size=   37101kB time=00:01:18.04 bitrate=3894.4kbitsframe= 1975 fps= 30 q=-1.0 size=   37613kB time=00:01:19.00 bitrate=3900.1kbitsframe= 2063 fps= 32 q=-1.0 size=   39388kB time=00:01:22.52 bitrate=3910.0kbits[http @ 0x23ded40] HTTP error 404 Not Found
    [hls,applehttp @ 0x22af2a0] Failed to reload playlist 0
    [http @ 0x22b4f60] HTTP error 404 Not Found
    [hls,applehttp @ 0x22af2a0] Failed to reload playlist 0
    frame= 2097 fps= 30 q=-1.0 size=   39967kB time=00:01:23.93 bitrate=3900.9kbitsframe= 2097 fps= 30 q=-1.0 Lsize=   40026kB time=00:01:23.93 bitrate=3906.7kbits/s    
    video:38657kB audio:1311kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.146131%
    
    15 条回复    2020-06-19 07:39:47 +08:00
    shitbreak
        1
    shitbreak  
    OP
       2020-06-17 23:08:34 +08:00
    本地也可以录,fash1043.cloudycdn.services 解析出 152.195.33.48 这个美国堪萨斯 ip,3000-4000 bitrate 挺高了,难道要开台美国 G 口鸡试?

    本地 dns 污染,hosts 加一行

    ```
    #Fashiontv
    152.195.33.48 fash1043.cloudycdn.services
    ```
    shitbreak
        2
    shitbreak  
    OP
       2020-06-17 23:09:31 +08:00
    观察到 fps 逐渐降到 30 左右,然后卡住 404,退出
    zhuzhibin
        3
    zhuzhibin  
       2020-06-18 01:33:25 +08:00 via iPhone
    老哥请教下 ffmpeg 如何将音频加到一个视频里面去 并且自定义导出视频的路径 例如 mp3 +mp4 输出一个带有 mp3 音乐的 mp4 视频
    bog
        4
    bog  
       2020-06-18 03:29:53 +08:00 via Android
    播了 6min,没什么问题呀
    expy
        5
    expy  
       2020-06-18 08:51:42 +08:00
    streamlink "hls://fash1043.cloudycdn.services/slive/_definst_/ftv_midnite_secrets_adaptive.smil/chunklist_b4700000_t64MTA4MHA=.m3u8" best -o v2ex.ts
    twoconk
        6
    twoconk  
       2020-06-18 09:18:24 +08:00
    @zhuzhibin 你这个需要用到音视频的合并,整理了常用的命令( https://it3q.com/article/59 ),可以参考
    myCupOfTea
        7
    myCupOfTea  
       2020-06-18 09:33:43 +08:00
    要不就先用 python 爬了,然后再 ffmpeg -i xxx.m3u8 -c copy out.mkv 合并
    shitbreak
        8
    shitbreak  
    OP
       2020-06-18 15:37:16 +08:00
    @myCupOfTea 太高级了。。。
    shitbreak
        9
    shitbreak  
    OP
       2020-06-18 15:42:25 +08:00
    @bog 我这广州移动宽带没办法,考虑在服务器完成再拖回来
    shitbreak
        10
    shitbreak  
    OP
       2020-06-18 15:47:22 +08:00
    @expy 请解释一下,大佬
    expy
        11
    expy  
       2020-06-18 16:01:46 +08:00
    @shitbreak https://streamlink.github.io/
    我试了一下能下载,就是中间有丢帧。
    shitbreak
        12
    shitbreak  
    OP
       2020-06-18 17:43:06 +08:00
    @expy 我估计它是一堆.ts 轮播,速度不够就丢帧
    myCupOfTea
        13
    myCupOfTea  
       2020-06-18 20:15:33 +08:00
    你这好像是直播流吧,我用我自己写的下片代码爬了下,好像每次访问下载的三个 ts 文件都不一样
    [email protected]:MyCupOfTeaOo/flv-download.git
    myCupOfTea
        14
    myCupOfTea  
       2020-06-18 20:15:54 +08:00
    wnpllrzodiac
        15
    wnpllrzodiac  
       2020-06-19 07:39:47 +08:00 via Android
    直接下载切片吧。或者换个 ua 。最基本的就是把 ff 的请求给限速,不让你这样人爽😄
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   3298 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 11:57 · PVG 19:57 · LAX 03:57 · JFK 06:57
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.