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

[bilibili] Support multiple formats #12095

Closed
CoXier opened this issue Feb 12, 2017 · 7 comments
Closed

[bilibili] Support multiple formats #12095

CoXier opened this issue Feb 12, 2017 · 7 comments
Labels

Comments

@CoXier
Copy link
Contributor

@CoXier CoXier commented Feb 12, 2017

In latest version ,bilibili.py has a bug:

payload = 'appkey=%s&cid=%s&otype=json&quality=1&type=mp4' % (self._APP_KEY, cid)

In my opinion,the type is which we choose such as mp4,flv,etc. 'type=mp4' means format of the file we download is 'mp4'.

In addition,quality param is enough.

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Feb 14, 2017

Could you give examples for how to change the payload and what's the difference in the resultant video?

@CoXier
Copy link
Contributor Author

@CoXier CoXier commented Feb 15, 2017

My strategy

payload = 'appkey=%s&cid=%s&otype=json&quality=%s&type=' % (self._APP_KEY, cid,quality)

Note:I don't set type any format.

How to know the range of quality?

As one video has at least quality 1,I first set quality 1 then I use above payload to get json data,like this:

{
  "from": "local",
  "result": "suee",
  "format": "mp4",
  "timelength": 2501412,
  "accept_format": "mp4,hdmp4,flv",
  "accept_quality": [
    3,
    2,
    1
  ],
  "seek_param": "start",
  "seek_type": "second",
  "durl": [
    {
      "order": 1,
      "length": 2501412,
      "size": 138266475,
      "url": "http://ws.acgvideo.com/a/be/6997314-1.mp4?wsTime=1487136532&platform=pc&wsSecret2=50cee32c1f82ee8a2a2836a40911b966&oi=1078436452&rate=650"
    }
  ]
}

According to accept_quality,I know the range of quality.

After I know the range of quality

Just loop.

what's the difference in the resultant video?

If you set type mp4,you just get one quality json data so you just can download one quality video ,in this condition,result video's format is mp4.

@remitamine
Copy link
Collaborator

@remitamine remitamine commented Feb 15, 2017

extracting all qualities will bring the problem in #6193.

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Feb 15, 2017

IIRC bilibili does not deliver segmented videos anymore.

@yan12125 yan12125 changed the title A suggestion for bilibili.py [bilibili] Support multiple formats Feb 15, 2017
@remitamine
Copy link
Collaborator

@remitamine remitamine commented Feb 15, 2017

last time i checked(baa3e18), 720p(quality=3) is delivered as segmented flv videos.

@remitamine
Copy link
Collaborator

@remitamine remitamine commented Feb 15, 2017

an example:

python __main__.py -F http://www.bilibili.com/video/av8581989/
[BiliBili] 8581989: Downloading webpage
[BiliBili] 8581989: Downloading video info page
[info] Available formats for 8581989:
format code  extension  resolution note
0            mp4        unknown    339.73MiB
ffprobe version 3.2.4 Copyright (c) 2007-2017 the FFmpeg developers
  built with gcc 6.3.1 (GCC) 20170109
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-avisynth --enable-avresample --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libass --enable-libbluray --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-netcdf --enable-shared --enable-version3 --enable-x11grab
  libavutil      55. 34.101 / 55. 34.101
  libavcodec     57. 64.101 / 57. 64.101
  libavformat    57. 56.101 / 57. 56.101
  libavdevice    57.  1.100 / 57.  1.100
  libavfilter     6. 65.100 /  6. 65.100
  libavresample   3.  1.  0 /  3.  1.  0
  libswscale      4.  2.100 /  4.  2.100
  libswresample   2.  3.100 /  2.  3.100
  libpostproc    54.  1.100 / 54.  1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'http://ws.acgvideo.com/a/c5/14130966-1-hd.mp4?wsTime=1487181415&platform=pc&wsSecret2=55319b749d5f7bf4a5662a4bca40532a&oi=1768863930&rate=1000':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.0.100
    description     : Coded by New Bilibili Transcoder v2.0.2
  Duration: 00:41:07.52, start: 0.000000, bitrate: 1154 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1080x608 [SAR 1216:1215 DAR 16:9], 1126 kb/s, 24 fps, 24 tbr, 12288 tbn, 48 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (HE-AACv2) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 22 kb/s (default)
    Metadata:
      handler_name    : SoundHandler

with quality=3&type=flv

python __main__.py -F http://www.bilibili.com/video/av8581989/
[BiliBili] 8581989: Downloading webpage
[BiliBili] 8581989: Downloading video info page
[download] Downloading playlist: 【骚男直播】2.12合集,疾跑亚索新套路,卡特斩获五杀,男刀被动伤害真的高,各种战歌翻盘
[BiliBili] playlist 【骚男直播】2.12合集,疾跑亚索新套路,卡特斩获五杀,男刀被动伤害真的高,各种战歌翻盘: Collected 7 video ids (downloading 7 of them)
[download] Downloading video 1 of 7
[info] Available formats for 8581989_part1:
format code  extension  resolution note
0            flv        unknown    83.26MiB
[download] Downloading video 2 of 7
[info] Available formats for 8581989_part2:
format code  extension  resolution note
0            flv        unknown    63.08MiB
[download] Downloading video 3 of 7
[info] Available formats for 8581989_part3:
format code  extension  resolution note
0            flv        unknown    77.55MiB
[download] Downloading video 4 of 7
[info] Available formats for 8581989_part4:
format code  extension  resolution note
0            flv        unknown    100.03MiB
[download] Downloading video 5 of 7
[info] Available formats for 8581989_part5:
format code  extension  resolution note
0            flv        unknown    48.80MiB
[download] Downloading video 6 of 7
[info] Available formats for 8581989_part6:
format code  extension  resolution note
0            flv        unknown    92.12MiB
[download] Downloading video 7 of 7
[info] Available formats for 8581989_part7:
format code  extension  resolution note
0            flv        unknown    55.96MiB
[download] Finished downloading playlist: 【骚男直播】2.12合集,疾跑亚索新套路,卡特斩获五杀,男刀被动伤害真的高,各种战歌翻盘
ffprobe version 3.2.4 Copyright (c) 2007-2017 the FFmpeg developers
  built with gcc 6.3.1 (GCC) 20170109
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-avisynth --enable-avresample --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libass --enable-libbluray --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-netcdf --enable-shared --enable-version3 --enable-x11grab
  libavutil      55. 34.101 / 55. 34.101
  libavcodec     57. 64.101 / 57. 64.101
  libavformat    57. 56.101 / 57. 56.101
  libavdevice    57.  1.100 / 57.  1.100
  libavfilter     6. 65.100 /  6. 65.100
  libavresample   3.  1.  0 /  3.  1.  0
  libswscale      4.  2.100 /  4.  2.100
  libswresample   2.  3.100 /  2.  3.100
  libpostproc    54.  1.100 / 54.  1.100
[flv @ 0x55d5795b4d00] video stream discovered after head already parsed
[flv @ 0x55d5795b4d00] audio stream discovered after head already parsed
Input #0, flv, from 'http://ws.acgvideo.com/a/c5/14130966-1.flv?wsTime=1487181367&platform=pc&wsSecret2=d919d7d9a4c881a908f3562b9fbd1065&oi=1768863930&rate=1500':
  Metadata:
    creator         : Coded by New Bilibili Transcoder v2.0.2
    metadatacreator : Yet Another Metadata Injector for FLV - Version 1.9
    hasKeyframes    : true
    hasVideo        : true
    hasAudio        : true
    hasMetadata     : true
    canSeekToEnd    : false
    datasize        : 87301879
    videosize       : 85935958
    audiosize       : 1281473
    lasttimestamp   : 410
    lastkeyframetimestamp: 400
    lastkeyframelocation: 85809838
  Duration: 00:06:49.73, start: 0.067000, bitrate: 1704 kb/s
    Stream #0:0: Video: h264 (High), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 30.30 fps, 30 tbr, 1k tbn, 60 tbc
    Stream #0:1: Audio: aac (HE-AACv2), 44100 Hz, stereo, fltp
@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Feb 15, 2017

Thanks. Then #6193 should be resolved first.

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

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.