Esempio n. 1
0
def notify(*args, **kwargs):
    self = args[0]
    context = args[1]

    main_task_id = kwargs["main_task_id"]
    if "complete" in kwargs and kwargs["complete"]:
        self.update_state(main_task_id, state="COMPLETE")
    else:
        self.update_state(main_task_id, state="PARTIAL", meta={"hls": get_hls_transcoded_playlist(context)})
    return context
Esempio n. 2
0
def add_playlist_info(*args, **kwargs):
    '''
    add this hls palylist info into the global hls playlist
    '''
    # print args, kwargs
    context = args[0]
    with open(get_hls_global_playlist(context), "a") as f:
        f.write("#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=" + str(
            context["bitrate"] * 1000) + ",RESOLUTION=" + get_hls_transcoded_playlist(context) + "\n")
    return context
def add_playlist_info(*args, **kwargs):
    '''
    add this hls palylist info into the global hls playlist
    '''
    # print args, kwargs
    context = args[0]
    dimsp = str(context["target_width"]) + "x" + str(context["target_height"])
    with open(get_hls_global_playlist(context), "a") as f:
        f.write("#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=" + str(
            context["bitrate"] * 1000) + ",RESOLUTION=" + dimsp + "\n" + "/".join(get_hls_transcoded_playlist(context).split("/")[-2:]) + "\n")
    return context
def notify(*args, **kwargs):
    self = args[0]
    context = args[1]

    main_task_id = kwargs["main_task_id"]
    if "complete" in kwargs and kwargs["complete"]:
        self.update_state(main_task_id, state="COMPLETE")
    else:
        self.update_state(main_task_id,
                          state="PARTIAL",
                          meta={"hls": get_hls_transcoded_playlist(context)})
    return context
Esempio n. 5
0
def add_playlist_info(*args, **kwargs):
    '''
    add this hls palylist info into the global hls playlist
    '''
    # print args, kwargs
    context = args[0]
    dimsp = str(context["target_width"]) + "x" + str(context["target_height"])
    with open(get_hls_global_playlist(context), "a") as f:
        f.write(
            "#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=" +
            str(context["bitrate"] * 1000) + ",RESOLUTION=" + dimsp + "\n" +
            "/".join(get_hls_transcoded_playlist(context).split("/")[-2:]) +
            "\n")
    return context
def chunk_hls(*args, **kwargs):
    '''
    create hls chunks and the version specific playlist
    '''
    # print args, kwargs
    context = args[0]

    if not os.path.exists(get_hls_transcoded_folder(context)):
        os.makedirs(get_hls_transcoded_folder(context))

    ffargs = "ffmpeg -i " + get_transcoded_file(
        context) + " -map 0 -flags +global_header -vcodec copy -vbsf h264_mp4toannexb -acodec copy -f segment -segment_format mpegts -segment_time " + str(
        context["segtime"]) + " -segment_wrap 0 -segment_list " + get_hls_transcoded_playlist(
        context) + " " + get_hls_transcoded_folder(context) + "/chunks_name%03d.ts"
    print ffargs
    run_background(ffargs)
    return context
def chunk_hls(*args, **kwargs):
    '''
    create hls chunks and the version specific playlist
    '''
    # print args, kwargs
    context = args[0]

    if not os.path.exists(get_hls_transcoded_folder(context)):
        os.makedirs(get_hls_transcoded_folder(context))

    ffargs = "ffmpeg -i " + get_transcoded_file(
        context
    ) + " -map 0 -flags +global_header -vcodec copy -vbsf h264_mp4toannexb -acodec copy -f segment -segment_format mpegts -segment_time " + str(
        context["segtime"]
    ) + " -segment_wrap 0 -segment_list " + get_hls_transcoded_playlist(
        context) + " " + get_hls_transcoded_folder(
            context) + "/chunks_name%03d.ts"
    print ffargs
    run_background(ffargs)
    return context