WO2012065559A1 - Method and device for restoring program recoded through iptv - Google Patents

Method and device for restoring program recoded through iptv Download PDF

Info

Publication number
WO2012065559A1
WO2012065559A1 PCT/CN2011/082342 CN2011082342W WO2012065559A1 WO 2012065559 A1 WO2012065559 A1 WO 2012065559A1 CN 2011082342 W CN2011082342 W CN 2011082342W WO 2012065559 A1 WO2012065559 A1 WO 2012065559A1
Authority
WO
WIPO (PCT)
Prior art keywords
program
recorded
files
failed
scanning
Prior art date
Application number
PCT/CN2011/082342
Other languages
French (fr)
Chinese (zh)
Inventor
赵国强
Original Assignee
中兴通讯股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2012065559A1 publication Critical patent/WO2012065559A1/en

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/433Content storage operation, e.g. storage operation in response to a pause request, caching operations
    • H04N21/4334Recording operations
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/60Network structure or processes for video distribution between server and client or between remote clients; Control signalling between clients, server and network components; Transmission of management data between server and client, e.g. sending from server to client commands for recording incoming content stream; Communication details between server and client 
    • H04N21/63Control signaling related to video distribution between client, server and network components; Network processes for video distribution between server and clients or between remote clients, e.g. transmitting basic layer and enhancement layers over different transmission paths, setting up a peer-to-peer communication via Internet between remote STB's; Communication protocols; Addressing
    • H04N21/643Communication protocols
    • H04N21/64322IP

Definitions

  • the present invention relates to the field of multimedia terminals, and in particular to a method and apparatus for recovering a program recorded by an IPTV (Interactive Personal Television).
  • IPTV Interactive Personal Television
  • BACKGROUND With the development of technology, multimedia terminal products, such as smart phones, PDAs, IPSTB (Interactive Personal Set Top Box, IP set-top boxes), various types of monitoring equipment, and conference televisions, will gradually enter thousands of households and become The indispensable part of people's life, such as IP set-top box, is a typical multimedia terminal device. With its rich program source, convenient operation mode and powerful multimedia service function, it has developed well in many places.
  • Recording a program is a business function of the set-top box, which is to store the program being played or the program of a certain period of time in the peripheral device for repeated viewing. Since the program played in the IPTV field uses TS (Transport Stream) encapsulation (TS encapsulation is a streaming media encapsulation format, as specified by ISO/IEC 13818), this encapsulation format has no key frame index table, so Trick Mode such as fast forward, rewind, and position can not be performed like network audio and video files such as AVI (Audio Video Interleave), MKV (Matroska Video, a video file format).
  • AVI Audio Video Interleave
  • MKV Magnatroska Video
  • the set-top box when the set-top box is recording, it is not only possible to store the media file alone, but also to perform partial TS syntax, PES (Packet Elementary Stream) syntax and image strip parsing, and to put the key frame PTS (Presentation Time Stamp). , play time mark), size and offset are all counted out, written into a file, this file is called key frame index file.
  • PES Packet Elementary Stream
  • PTS Presentation Time Stamp
  • size and offset are all counted out, written into a file, this file is called key frame index file.
  • the media files will also be stored in slices, as shown in Figure 1. Once a shard has a write or read error, you can skip this shard and operate on the next shard.
  • Each recorded media stream is stored in a folder, which has a slice index file (used to record the duration of the entire program, how many fragments, the start time and duration of each slice play, etc.) ), N fragment files and each fragment file correspond to a key frame index file.
  • the recorded file structure is shown in Figure 1.
  • you need to perform fast-forward, rewind, positioning, etc. you need to find the corresponding keyframe. If it is positioning, you need to find the time point in a certain fragment file according to the fragment index file, and then find out which key frame playback time is consistent with this time point in this fragment file. After finding it, take out this.
  • the offset of the key frame starting from this offset as the starting point Play. If it is fast forward and rewind, you need to find the key frame of a certain time interval according to a certain strategy, then take out the key frame according to the offset and size, play the key frame, and then repeat this operation until recovery. Normal playback.
  • the recording process is a process of continuously writing files. The stability of the system is very high. Once an unexpected power failure occurs, the linux system accesses the file (the Linux system reads the contents of the file and writes it again. If the power is turned off after reading, the content of the file may not be written back to the file. Some file files that are being read or written will be damaged, resulting in the recorded program not playing properly or performing special effects or even crashing.
  • the present invention provides a method and apparatus for restoring a program recorded by an IPTV, so as to at least solve the problem that a program recorded in the related art cannot be played normally or cannot perform a trick operation.
  • a method for recovering a program recorded by an IPTV including: determining whether there is a program that fails to be recorded by scanning the recorded program; if present, recording the program that has failed to be recorded All corresponding files are scanned to obtain program recovery information; and the program that failed to be recorded is restored using the program recovery information.
  • the step of scanning all the files corresponding to the program that failed to be recorded to obtain the program recovery information includes: obtaining, by the scanning, parameter information of all the fragment files of the program that failed to be recorded, wherein the parameter information includes: The number of the fragmentation files, the playback start time and the duration of each of the fragmentation files; the parameter information is recorded in the fragmentation index file of the program that failed to be recorded, wherein the program recovery information includes The fragment index file.
  • the step of scanning all the files corresponding to the program that failed to be recorded to obtain the program recovery information further includes: obtaining, by the scanning, the playing information of each key frame of each of the fragment files, where the playing information includes The playback time stamp PTS, the location and the size; the playback information of all the key frames of each of the fragment files are respectively recorded in a key frame index file corresponding to the fragment file, where one of the fragment files corresponds to One of the key frame index files, the program recovery information further includes a key frame index file.
  • the step of scanning all the files corresponding to the program that failed to be recorded to obtain the program recovery information further includes: a code stream of a beginning portion of the first fragment file and a code stream of an end portion of the last fragment Performing a scan to obtain a first key frame and a last one of the key frames; calculating a difference between the PTS of the first key frame and the last key frame to obtain a play duration of the program that failed to be recorded; Recording the play duration into the slice index file.
  • the step of scanning all the files corresponding to the program that failed to be recorded to obtain the program recovery information further includes: calculating a file size of all the fragment files by using a system function; calculating a sum of file sizes of all the fragment files The size of the program that failed to be recorded; the size of the program that failed to be recorded is recorded in the slice index file.
  • the step of scanning all the files corresponding to the program that failed to record to obtain program recovery information further includes: reading a PTS of the first key frame in each of the key frame index files; and reading the PTS record to be read Go to the slice index file.
  • the step of restoring the recorded failed program using the program recovery information includes: playing the recorded failed program using the slice index file.
  • an apparatus for recovering a program recorded by an IPTV comprising: a judging unit configured to judge whether there is a program that has failed to be recorded by scanning the recorded program; and the scanning unit is set to When there is a program that fails to be recorded, all files corresponding to the program that failed to be recorded are scanned to obtain program restoration information; and a recovery unit is configured to restore the program that failed to be recorded using the program restoration information.
  • the scanning unit includes: a first scanning module, configured to obtain parameter information of all the fragment files of the program that failed to be recorded by the scanning, where the parameter information includes: the number of the fragment files, each a playback start time and a duration of the fragment file; the first recording module is configured to record the parameter information into a fragment index file of the program that failed to be recorded, where the program recovery information includes The fragment index file.
  • the scanning unit further includes: a second scanning module, configured to obtain, by the scanning, playback information of each key frame of each of the fragment files, where the playback information includes: a play time stamp PTS, a location, and
  • the second recording module is configured to record the playback information of all the key frames of each of the fragment files into a key frame index file corresponding to the fragment file, where one of the fragment files corresponds to one
  • the key frame index file, the program recovery information further includes a key frame index file.
  • FIG. 1 is a structural diagram of a set top box fragment file according to the related art
  • FIG. 2 is a preferred flowchart of a method for restoring an IPTV recorded program according to an embodiment of the present invention
  • FIG. 2 is a preferred flowchart of a method for restoring an IPTV recorded program according to an embodiment of the present invention
  • FIG. 2 is a preferred flowchart of a method for restoring an IPTV recorded program according to an embodiment of the present invention
  • FIG. 2 is a preferred flowchart of a method for restoring an IPTV recorded program according to an embodiment of the present invention
  • FIG. 2 is a preferred flowchart of a method for restoring an IPTV recorded program according to an embodiment of the present invention
  • FIG. 2 is a preferred structural diagram of a recovery device for an IPTV recorded program of an embodiment
  • FIG. 1 is a structural diagram of a set top box fragment file according to the related art
  • FIG. 2 is a preferred flowchart of a method for restoring an IPTV recorded program according
  • FIG. 4 is another preferred flowchart of a method for restoring a program recorded by an IPTV according to an embodiment of the present invention
  • FIG. Another preferred structural diagram of the recovery device for the IPTV recorded program.
  • DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS The preferred embodiments of the present invention are described with reference to the accompanying drawings, and the preferred embodiments of the present invention are intended to illustrate and explain the invention. This example illustrates the process of repairing a recorded file.
  • the communication may be implemented by a wireless connection or a wired connection or a combination of both, which is not limited by the present invention.
  • Embodiment 1 FIG. 2 is a preferred flowchart of a method for restoring a program recorded by an IPTV according to an embodiment of the present invention, which includes the following steps:
  • S202 determining whether there is a program that fails to be recorded by scanning the recorded program; S204, if yes, scanning all the files corresponding to the program that failed to be recorded to obtain program recovery information;
  • S206 Restore the recorded failed program by using the program recovery information.
  • the program recovery information is obtained by scanning, so as to repair the damaged program, and the problem that the recorded program in the related art cannot be played normally or cannot perform the trick operation is solved, and the capacity of the terminal is improved. Wrongness and stability with the business operations system. In addition, it saves time and effort for the user to record twice.
  • the step of scanning all the files corresponding to the program that failed to be recorded to obtain the program recovery information includes: obtaining, by the scanning, parameter information of all the fragment files of the program that failed to be recorded, wherein the parameter information
  • the method includes: the number of the fragmentation files, a playback start time and a duration of each of the fragmentation files; and the parameter information is recorded in a fragmentation index file of the program that fails to be recorded, where the program
  • the recovery information includes the slice index file.
  • the parameter information of the obtained fragment file can be effectively utilized to recover the program damaged by the fragment file.
  • the step of scanning all the files corresponding to the program that failed to be recorded to obtain the program recovery information further includes: obtaining, by the scanning, playing information of each key frame of each of the fragment files, where
  • the play information includes: a play time stamp PTS, a position and a size; and the play information of all the key frames of each of the slice files are respectively recorded into a key frame index file corresponding to the slice file, wherein one of the points The slice file corresponds to one of the key frame index files, and the program recovery information further includes a key frame index file.
  • the obtained fragment file and key frame index file can be effectively utilized to recover the corrupted program of the fragment file and the key frame index file.
  • the step of scanning all the files corresponding to the program that failed to record to obtain program recovery information further includes: a code stream of a beginning portion of the first fragment file and an end portion of a last one of the fragments Scanning the code stream to obtain the first key frame and the last one of the key frames; calculating a difference between the PTS of the first key frame and the last key frame to obtain the program of the recording failure Play duration; record the play duration into the slice index file.
  • the obtained fragment file and key frame index file can be effectively utilized to recover the corrupted program of the fragment file and the key frame index file.
  • the step of scanning all the files corresponding to the program that failed to be recorded to obtain the program recovery information further includes: calculating a file size of all the fragment files by using a system function; and calculating a file size of all the fragment files. And obtaining a size of the program that the recording failed; recording the size of the program that failed to be recorded into the fragment index file.
  • the obtained fragment file can be effectively utilized to recover the program whose fragment file is corrupted.
  • the step of scanning all the files corresponding to the recorded failed program to obtain the program recovery information further comprises: reading the PTS of the first key frame in each of the key frame index files; The PTS record is recorded in the slice index file.
  • the obtained fragment file and key frame index file can be effectively utilized to recover the corrupted program of the fragment file and the key frame index file.
  • the step of restoring the recorded failed program using the program recovery information comprises: playing the recorded failed program by using the fragment index file.
  • the obtained fragment file can be effectively utilized to recover the program whose fragment file is corrupted.
  • a file that is normally recorded can be marked to indicate that the recorded file is complete, and such a file does not need to be scanned. When a recording process ends normally, a flag like this is set. Therefore, when a recorded file is to be played, it is found that there is no such mark, and the recorded file is repaired.
  • FIG. 3 is a schematic structural diagram of a device for restoring an IPTV recorded program according to an embodiment of the present invention, which includes: a scanning module 302, a repair module 304 in communication with the scanning module 302, and a communication module 304
  • the system module 308 is configured to interact with a function of the system to obtain information such as a structure and a path of the recorded file.
  • the TS packet demultiplexing module 306 is arranged to be responsible for demultiplexing the TS packets, analyzing the type of each frame, the PTS, the displacement and the size of each frame.
  • the scanning module 302 is arranged to scan the entire recorded program, and for the program that failed to be recorded, the repair module 304 will be called to repair.
  • the repair module 304 is arranged to write the result of the repair to the file by invoking the system module and the TS packet demultiplexing module 306.
  • the repairing step of the repair module 304 can be referred to the embodiment 1, and details are not described herein again.
  • FIG. 4 is another preferred flowchart of a method for restoring a program recorded by an IPTV according to an embodiment of the present invention, which includes the following steps:
  • step S404 Find whether there is a program that fails to record; if yes, go to step S406; otherwise, go to step S418.
  • S408 Scan the code stream at the beginning of the first slice file and the code stream at the end of the last slice to find the first key frame and the last key frame respectively.
  • the difference between the PTSs of the above two key frames is calculated as the total duration of the program's play time.
  • the calling system function calculates the size of all the fragments in the program, calculates the sum of the sizes of all the fragment files, and obtains the size of the recorded program file_length.
  • FIG. 5 is another preferred structural diagram of a device for restoring an IPTV recorded program according to an embodiment of the present invention, which includes: a determining unit 502 configured to determine whether a recording exists by scanning a recorded program.
  • the scanning unit 504 in communication with the determining unit 502, configured to scan all files corresponding to the program that failed to be recorded to obtain program recovery information when the program that fails to be recorded is present; 506. Communicate with the scanning unit 504, configured to use the program recovery information to restore the recorded failed program.
  • the program recovery information is obtained by scanning to repair the damaged program, and the problem that the recorded program in the related art cannot be played normally or cannot perform the trick operation is solved, and the fault tolerance of the terminal and the business operation are improved. Stability between systems. In addition, it saves time and effort for the user to record twice.
  • the scanning unit 504 includes: a first scanning module, configured to obtain, by using the scanning, parameter information of all the fragment files of the program that fails to be recorded, where the parameter information includes: the fragment file The number, the playback start time and the duration of each of the fragment files; the first recording module, in communication with the first scanning module, configured to record the parameter information to the fragment index file of the program that failed to be recorded
  • the program recovery information includes the fragment index file.
  • the parameter information of the obtained fragment file can be effectively utilized to recover the program damaged by the fragment file.
  • the scanning unit 504 further includes: a second scanning module, configured to obtain, by using the scanning, play information of each key frame of each of the fragment files, where the play information includes: a play time mark PTS, location and size; the second recording module is configured to communicate with the second scanning module, and set the playback information of all the key frames of each of the fragment files to the key frame index file corresponding to the fragment file.
  • the program recovery information further includes a key frame index file.
  • the obtained fragment file and key frame index file can be effectively utilized to recover the corrupted program of the fragment file and the key frame index file.
  • the scanning unit 504 scans all the files corresponding to the program that failed to be recorded to obtain program recovery information, and further includes: a code stream of a beginning portion of the first fragment file and a last one of the fragments The end of the code stream is scanned to obtain the first of the key frame and the last of the key frames; calculating the difference between the PTS of the first key frame and the last key frame to obtain the recording failure The playing duration of the program; recording the playing duration into the fragment index file.
  • the obtained fragment file and key frame index file can be effectively utilized to recover the corrupted program of the fragment file and the key frame index file.
  • the scanning unit 504 scans all the files corresponding to the program that failed to be recorded to obtain program recovery information, and further includes: calculating, by using a system function, a file size of all the fragment files; and calculating all the fragment files.
  • the sum of the file sizes is the size of the program that failed to be recorded; the size of the program that failed to be recorded is recorded in the slice index file.
  • the obtained fragment file can be effectively utilized to recover the program whose fragment file is corrupted.
  • the scanning unit 504 scans all the files corresponding to the recorded failed program to obtain the program recovery information, further comprising: reading the PTS of the first key frame in each of the key frame index files; The PTS is taken into the fragment index file.
  • the obtained fragment file and key frame index file can be effectively utilized to recover the corrupted program of the fragment file and the key frame index file.
  • the recovering unit 506 recovering the recorded failed program by using the program recovery information comprises: playing the recorded failed program by using the fragment index file.
  • the obtained fragment file can be effectively utilized to recover the program whose fragment file is corrupted.
  • a file that is normally recorded can be marked to indicate that the recorded file is complete, and such a file does not need to be scanned. When a recording process ends normally, a flag like this is set. Therefore, when a recorded file is to be played, it is found that there is no such mark, and the recorded file is repaired.
  • the method further includes: the determining unit 502 detecting whether the recorded program is set with a normal recording mark, and if present, not scanning the recorded program. .
  • the above modules or steps of the present invention can be implemented by a general-purpose computing device, which can be concentrated on a single computing device or distributed over a network composed of multiple computing devices. Alternatively, they may be implemented by program code executable by the computing device, such that they may be stored in the storage device by the computing device and, in some cases, may be different from the order herein.

Abstract

Disclosed are a method and a device for restoring a program recoded through IPTV. The method comprises: scanning recorded programs to judge whether an unsuccessfully recorded program exists; if the program exists, scanning all files corresponding to the unsuccessfully recorded program to obtain program restoration information; and restoring the unsuccessfully recorded program by using the program restoration information. The present invention solves the problem in the relevant art that a recorded program cannot be played, thereby increasing fault tolerance of a terminal and stability between the terminal and a service operating system.

Description

网络电视录制的节目的恢复方法和装置 技术领域 本发明涉及多媒体终端领域, 具体而言, 涉及一种 IPTV ( Interactive Personal Television, 网络电视) 录制的节目的恢复方法和装置。 背景技术 随着科技的发展,多媒体终端产品,比如说智能手机,掌上电脑, IPSTB (Interactive Personal Set Top Box, IP机顶盒), 各类监控设备和会议电视等, 会逐步进入了千 家万户, 成为人们生活中不可缺少的部分, 例如 IP机顶盒作为一种典型的多媒体终 端设备, 以其丰富的节目源, 方便的操作方式, 强大的多媒体业务功能, 在很多地 方有着良好的发展。 录制节目是机顶盒的一个业务功能, 是将正在播放的节目或某个时段的节目存储 在外设中, 以便反复观赏。 由于在 IPTV领域播放的节目采用 TS (Transport Stream, 传输流) 封装 (TS封装是一种流媒体封装格式, 由 ISO/IEC 13818规定), 这种封装 格式是没有关键帧索引表的, 所以就不能像 AVI (Audio Video Interleave, 数字视频文 件格式)、 MKV (Matroska Video, 一种视频文件格式)等网络音视频文件那样做快进、 快退和定位等特技操作 (Trick Mode)。 因此机顶盒在录制时, 不能只单单存储媒体文 件, 还要对其进行部分 TS语法、 PES (Packet Elementary Stream, 打包的基本码流) 语法和图像条语法分析, 将关键帧的 PTS (Presentation Time Stamp, 播放时间标记)、 大小和偏移量全部统计出来, 写入一个文件里, 这个文件叫关键帧索引文件。 为了读取方便, 媒体文件也将分片存储, 如图 1所示。 一旦某个分片出现写入或 读取错误, 还可以跳过这个分片, 对下一个分片进行操作。 每个录制的媒体流都存放 在一个文件夹下, 这其中有一个分片索引文件 (用来记录整个节目的时长, 有多少个 分片, 每个分片播放的起始时间和时长等信息), N个分片文件和每个分片文件对应一 个关键帧索引文件。 录制出来的文件结构如图 1所示。 当正常播放时, 是不需要索引文件参与的, 只 需要按码率一个个读取分片文件来播放就可以了。 当需要快进快退、 定位等特技操作 时, 就需要找到对应的关键帧。 如果是定位, 就需要根据分片索引文件找到这个时间 点在某个分片文件中, 再在这个分片文件中找具体是哪个关键帧的播放时间与这个时 间点一致, 找到之后, 取出这个关键帧的偏移量, 就从这个偏移量为起始点开始继续 播放。 如果是快进快退, 就需要根据一定的策略找到一定时间间隔的关键帧所在, 再 根据偏移量和大小取出这个关键帧出来, 将这个关键帧播放出来, 然后再重复这个操 作, 直到恢复正常播放为止。 录制的过程是一个不断写文件的过程, 对系统的稳定性要求很高, 一旦出现意外 的掉电情况, linux系统对文件访问的方式 (linux系统是将文件的内容读出, 再写入, 如果在读出后掉电, 就可能文件的内容没有来得及写回文件中) 致使一些正在进行读 写的分片文件会损坏, 从而导致录制的节目无法正常播放或无法进行特技操作, 甚至 死机。 发明内容 本发明提供了一种 IPTV录制的节目的恢复方法和装置, 以至少解决相关技术中 录制的节目无法正常播放或无法进行特技操作的问题。 根据本发明的一个方面, 提供了一种 IPTV录制的节目的恢复方法, 其包括: 通 过对所录制的节目进行扫描来判断是否存在录制失败的节目; 若存在, 则对所述录制 失败的节目对应的所有文件进行扫描得到节目恢复信息; 使用所述节目恢复信息对所 述录制失败的节目进行恢复。 对所述录制失败的节目对应的所有文件进行扫描得到节目恢复信息的步骤包括: 通过所述扫描得到所述录制失败的节目的所有分片文件的参数信息, 其中, 所述参数 信息包括: 所述分片文件的数量、 每个所述分片文件的播放起始时间和时长; 将所述 参数信息记录到所述录制失败的节目的分片索引文件中, 其中, 所述节目恢复信息包 括所述分片索引文件。 对所述录制失败的节目对应的所有文件进行扫描得到节目恢复信息的步骤还包 括: 通过所述扫描得到每个所述分片文件的每个关键帧的播放信息, 其中, 所述播放 信息包括: 播放时间标记 PTS、 位置和大小; 将每个所述分片文件的所有关键帧的播 放信息分别记录到与该分片文件对应的关键帧索引文件中, 其中, 一个所述分片文件 对应一个所述关键帧索引文件, 所述节目恢复信息还包括关键帧索引文件。 对所述录制失败的节目对应的所有文件进行扫描得到节目恢复信息的步骤还包 括: 对第一个所述分片文件的开始部分的码流和最后一个所述分片的结束部分的码流 进行扫描, 得到第一个所述关键帧和最后一个所述关键帧; 计算所述第一个关键帧和 所述最后一个关键帧的 PTS的差值得到所述录制失败的节目的播放时长; 将所述播放 时长记录到所述分片索引文件中。 对所述录制失败的节目对应的所有文件进行扫描得到节目恢复信息的步骤还包 括: 通过系统函数计算所有所述分片文件的文件大小; 计算所有所述分片文件的文件 大小之和得到所述录制失败的节目的大小; 将所述录制失败的节目的大小记录到所述 分片索引文件中。 对所述录制失败的节目对应的所有文件进行扫描得到节目恢复信息的步骤还包 括: 读取每个所述关键帧索引文件中的第一个关键帧的 PTS; 将读取的所述 PTS记录 到所述分片索引文件中。 使用所述节目恢复信息对所述录制失败的节目进行恢复的步骤包括: 使用所述分 片索引文件来播放所述录制失败的节目。 根据本发明的另一方面, 提供了一种 IPTV录制的节目的恢复装置, 其包括: 判 断单元, 设置为通过对所录制的节目进行扫描来判断是否存在录制失败的节目; 扫描 单元, 设置为在存在所述录制失败的节目时, 对所述录制失败的节目对应的所有文件 进行扫描得到节目恢复信息; 恢复单元, 设置为使用所述节目恢复信息对所述录制失 败的节目进行恢复。 所述扫描单元包括: 第一扫描模块, 设置为通过所述扫描得到所述录制失败的节 目的所有分片文件的参数信息, 其中, 所述参数信息包括: 所述分片文件的数量、 每 个所述分片文件的播放起始时间和时长; 第一记录模块, 设置为将所述参数信息记录 到所述录制失败的节目的分片索引文件中, 其中, 所述节目恢复信息包括所述分片索 引文件。 所述扫描单元还包括: 第二扫描模块, 设置为通过所述扫描得到每个所述分片文 件的每个关键帧的播放信息, 其中, 所述播放信息包括: 播放时间标记 PTS、 位置和 大小; 第二记录模块, 设置为将每个所述分片文件的所有关键帧的播放信息分别记录 到与该分片文件对应的关键帧索引文件中, 其中, 一个所述分片文件对应一个所述关 键帧索引文件, 所述节目恢复信息还包括关键帧索引文件。 在本发明中, 修复了损坏的节目, 解决了相关技术中录制的节目无法正常播放或 无法进行特技操作的问题, 提高了终端的容错性以及与业务运营系统之间的稳定性。 附图说明 此处所说明的附图用来提供对本发明的进一步理解, 构成本申请的一部分, 本发 明的示意性实施例及其说明用于解释本发明, 并不构成对本发明的不当限定。 在附图 中: 图 1是根据相关技术的机顶盒分片文件的结构图; 图 2是根据本发明实施例的 IPTV录制的节目的恢复方法的一种优选的流程图; 图 3是根据本发明实施例的 IPTV录制的节目的恢复装置的一种优选的结构图; 图 4是根据本发明实施例的 IPTV录制的节目的恢复方法的另一种优选的流程图; 图 5是根据本发明实施例的 IPTV录制的节目的恢复装置的另一种优选的结构图。 具体实施方式 以下结合附图对本发明的优选实例进行说明, 应当理解, 此处所描述的优选实施 例仅用于说明和解释本发明, 并不用于限定本发明。 本实例说明了修复录制文件的流 程。 在以下各个实施例中, 通信可以由无线连接或有线连接或其两者的组合来实现, 本发明 对此不做限定。 实施例 1 图 2是根据本发明实施例的 IPTV录制的节目的恢复方法的一种优选的流程图, 其包括如下步骤: BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to the field of multimedia terminals, and in particular to a method and apparatus for recovering a program recorded by an IPTV (Interactive Personal Television). BACKGROUND With the development of technology, multimedia terminal products, such as smart phones, PDAs, IPSTB (Interactive Personal Set Top Box, IP set-top boxes), various types of monitoring equipment, and conference televisions, will gradually enter thousands of households and become The indispensable part of people's life, such as IP set-top box, is a typical multimedia terminal device. With its rich program source, convenient operation mode and powerful multimedia service function, it has developed well in many places. Recording a program is a business function of the set-top box, which is to store the program being played or the program of a certain period of time in the peripheral device for repeated viewing. Since the program played in the IPTV field uses TS (Transport Stream) encapsulation (TS encapsulation is a streaming media encapsulation format, as specified by ISO/IEC 13818), this encapsulation format has no key frame index table, so Trick Mode such as fast forward, rewind, and position can not be performed like network audio and video files such as AVI (Audio Video Interleave), MKV (Matroska Video, a video file format). Therefore, when the set-top box is recording, it is not only possible to store the media file alone, but also to perform partial TS syntax, PES (Packet Elementary Stream) syntax and image strip parsing, and to put the key frame PTS (Presentation Time Stamp). , play time mark), size and offset are all counted out, written into a file, this file is called key frame index file. For the convenience of reading, the media files will also be stored in slices, as shown in Figure 1. Once a shard has a write or read error, you can skip this shard and operate on the next shard. Each recorded media stream is stored in a folder, which has a slice index file (used to record the duration of the entire program, how many fragments, the start time and duration of each slice play, etc.) ), N fragment files and each fragment file correspond to a key frame index file. The recorded file structure is shown in Figure 1. When playing normally, it is not necessary to participate in the index file. It only needs to read the fragment file one by one at the code rate to play it. When you need to perform fast-forward, rewind, positioning, etc., you need to find the corresponding keyframe. If it is positioning, you need to find the time point in a certain fragment file according to the fragment index file, and then find out which key frame playback time is consistent with this time point in this fragment file. After finding it, take out this. The offset of the key frame, starting from this offset as the starting point Play. If it is fast forward and rewind, you need to find the key frame of a certain time interval according to a certain strategy, then take out the key frame according to the offset and size, play the key frame, and then repeat this operation until recovery. Normal playback. The recording process is a process of continuously writing files. The stability of the system is very high. Once an unexpected power failure occurs, the linux system accesses the file (the Linux system reads the contents of the file and writes it again. If the power is turned off after reading, the content of the file may not be written back to the file. Some file files that are being read or written will be damaged, resulting in the recorded program not playing properly or performing special effects or even crashing. SUMMARY OF THE INVENTION The present invention provides a method and apparatus for restoring a program recorded by an IPTV, so as to at least solve the problem that a program recorded in the related art cannot be played normally or cannot perform a trick operation. According to an aspect of the present invention, a method for recovering a program recorded by an IPTV is provided, including: determining whether there is a program that fails to be recorded by scanning the recorded program; if present, recording the program that has failed to be recorded All corresponding files are scanned to obtain program recovery information; and the program that failed to be recorded is restored using the program recovery information. The step of scanning all the files corresponding to the program that failed to be recorded to obtain the program recovery information includes: obtaining, by the scanning, parameter information of all the fragment files of the program that failed to be recorded, wherein the parameter information includes: The number of the fragmentation files, the playback start time and the duration of each of the fragmentation files; the parameter information is recorded in the fragmentation index file of the program that failed to be recorded, wherein the program recovery information includes The fragment index file. The step of scanning all the files corresponding to the program that failed to be recorded to obtain the program recovery information further includes: obtaining, by the scanning, the playing information of each key frame of each of the fragment files, where the playing information includes The playback time stamp PTS, the location and the size; the playback information of all the key frames of each of the fragment files are respectively recorded in a key frame index file corresponding to the fragment file, where one of the fragment files corresponds to One of the key frame index files, the program recovery information further includes a key frame index file. The step of scanning all the files corresponding to the program that failed to be recorded to obtain the program recovery information further includes: a code stream of a beginning portion of the first fragment file and a code stream of an end portion of the last fragment Performing a scan to obtain a first key frame and a last one of the key frames; calculating a difference between the PTS of the first key frame and the last key frame to obtain a play duration of the program that failed to be recorded; Recording the play duration into the slice index file. The step of scanning all the files corresponding to the program that failed to be recorded to obtain the program recovery information further includes: calculating a file size of all the fragment files by using a system function; calculating a sum of file sizes of all the fragment files The size of the program that failed to be recorded; the size of the program that failed to be recorded is recorded in the slice index file. The step of scanning all the files corresponding to the program that failed to record to obtain program recovery information further includes: reading a PTS of the first key frame in each of the key frame index files; and reading the PTS record to be read Go to the slice index file. The step of restoring the recorded failed program using the program recovery information includes: playing the recorded failed program using the slice index file. According to another aspect of the present invention, there is provided an apparatus for recovering a program recorded by an IPTV, comprising: a judging unit configured to judge whether there is a program that has failed to be recorded by scanning the recorded program; and the scanning unit is set to When there is a program that fails to be recorded, all files corresponding to the program that failed to be recorded are scanned to obtain program restoration information; and a recovery unit is configured to restore the program that failed to be recorded using the program restoration information. The scanning unit includes: a first scanning module, configured to obtain parameter information of all the fragment files of the program that failed to be recorded by the scanning, where the parameter information includes: the number of the fragment files, each a playback start time and a duration of the fragment file; the first recording module is configured to record the parameter information into a fragment index file of the program that failed to be recorded, where the program recovery information includes The fragment index file. The scanning unit further includes: a second scanning module, configured to obtain, by the scanning, playback information of each key frame of each of the fragment files, where the playback information includes: a play time stamp PTS, a location, and The second recording module is configured to record the playback information of all the key frames of each of the fragment files into a key frame index file corresponding to the fragment file, where one of the fragment files corresponds to one The key frame index file, the program recovery information further includes a key frame index file. In the present invention, the damaged program is repaired, and the problem that the recorded program in the related art cannot be played normally or the trick operation cannot be performed is solved, and the fault tolerance of the terminal and the stability with the business operation system are improved. BRIEF DESCRIPTION OF THE DRAWINGS The accompanying drawings, which are set to illustrate,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, In the drawings: FIG. 1 is a structural diagram of a set top box fragment file according to the related art; FIG. 2 is a preferred flowchart of a method for restoring an IPTV recorded program according to an embodiment of the present invention; A preferred structural diagram of a recovery device for an IPTV recorded program of an embodiment; FIG. 4 is another preferred flowchart of a method for restoring a program recorded by an IPTV according to an embodiment of the present invention; FIG. Another preferred structural diagram of the recovery device for the IPTV recorded program. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS The preferred embodiments of the present invention are described with reference to the accompanying drawings, and the preferred embodiments of the present invention are intended to illustrate and explain the invention. This example illustrates the process of repairing a recorded file. In the following embodiments, the communication may be implemented by a wireless connection or a wired connection or a combination of both, which is not limited by the present invention. Embodiment 1 FIG. 2 is a preferred flowchart of a method for restoring a program recorded by an IPTV according to an embodiment of the present invention, which includes the following steps:
S202, 通过对所录制的节目进行扫描来判断是否存在录制失败的节目; S204, 若存在, 则对所述录制失败的节目对应的所有文件进行扫描得到节目恢复 信息; S202, determining whether there is a program that fails to be recorded by scanning the recorded program; S204, if yes, scanning all the files corresponding to the program that failed to be recorded to obtain program recovery information;
S206, 使用所述节目恢复信息对所述录制失败的节目进行恢复。 在本优选的实施例中, 通过扫描得到节目恢复信息, 以便修复损坏的节目, 解决 了相关技术中录制的节目无法正常播放或无法进行特技操作的问题, 提高了终端的容 错性以及与业务运营系统之间的稳定性。 此外, 对于用户来说, 还节省了因二次录制 而花费的时间和精力。 优选的, 对所述录制失败的节目对应的所有文件进行扫描得到节目恢复信息的步 骤包括: 通过所述扫描得到所述录制失败的节目的所有分片文件的参数信息, 其中, 所述参数信息包括: 所述分片文件的数量、每个所述分片文件的播放起始时间和时长; 将所述参数信息记录到所述录制失败的节目的分片索引文件中, 其中, 所述节目恢复 信息包括所述分片索引文件。 在本优选的实施例中, 可以有效地利用得到的分片文件 的参数信息对分片文件损坏的节目进行恢复。 优选的, 对所述录制失败的节目对应的所有文件进行扫描得到节目恢复信息的步 骤还包括: 通过所述扫描得到每个所述分片文件的每个关键帧的播放信息, 其中, 所 述播放信息包括: 播放时间标记 PTS、 位置和大小; 将每个所述分片文件的所有关键 帧的播放信息分别记录到与该分片文件对应的关键帧索引文件中, 其中, 一个所述分 片文件对应一个所述关键帧索引文件, 所述节目恢复信息还包括关键帧索引文件。 在 本优选的实施例中, 可以有效地利用得到的分片文件和关键帧索引文件对分片文件和 关键帧索引文件损坏的节目进行恢复。 优选的, 对所述录制失败的节目对应的所有文件进行扫描得到节目恢复信息的步 骤还包括: 对第一个所述分片文件的开始部分的码流和最后一个所述分片的结束部分 的码流进行扫描, 得到第一个所述关键帧和最后一个所述关键帧; 计算所述第一个关 键帧和所述最后一个关键帧的 PTS的差值得到所述录制失败的节目的播放时长; 将所 述播放时长记录到所述分片索引文件中。 在本优选的实施例中, 可以有效地利用得到 的分片文件和关键帧索引文件对分片文件和关键帧索引文件损坏的节目进行恢复。 优选的, 对所述录制失败的节目对应的所有文件进行扫描得到节目恢复信息的步 骤还包括: 通过系统函数计算所有所述分片文件的文件大小; 计算所有所述分片文件 的文件大小之和得到所述录制失败的节目的大小; 将所述录制失败的节目的大小记录 到所述分片索引文件中。 在本优选的实施例中, 可以有效地利用得到的分片文件对分 片文件损坏的节目进行恢复。 优选的, 对所述录制失败的节目对应的所有文件进行扫描得到节目恢复信息的步 骤还包括:读取每个所述关键帧索引文件中的第一个关键帧的 PTS;将读取的所述 PTS 记录到所述分片索引文件中。 在本优选的实施例中, 可以有效地利用得到的分片文件 和关键帧索引文件对分片文件和关键帧索引文件损坏的节目进行恢复。 优选的, 使用所述节目恢复信息对所述录制失败的节目进行恢复的步骤包括: 使 用所述分片索引文件来播放所述录制失败的节目。 在本优选的实施例中, 可以有效地 利用得到的分片文件对分片文件损坏的节目进行恢复。 优选的, 由于要扫描的文件会很大,所以可以对正常录制完成的文件作一个标记, 用于说明这个录制的文件是完整的, 这样的文件就不需要扫描了。 当一个录制的过程 正常结束后, 就设置一个这样的标记。 所以, 当要播放某个录制的文件时, 发现没有 这样的标记, 就要对这个录制的文件进行修复。 因此, 在通过对所录制的节目进行扫描来判断是否存在录制失败的节目之前, 还 包括: 检测所录制的节目是否设置有正常录制标记, 若存在, 则不对该录制的节目进 行扫描。 实施例 2 图 3是根据本发明实施例的 IPTV录制的节目的恢复装置的一种优选的结构图, 其包括: 扫描模块 302、 与扫描模块 302通信的修复模块 304、 与修复模块 304通信的 TS包解复用模块 306、 与 TS包解复用模块 306通信的系统模块 308。 其中, 系统模块 308设置为和系统的函数交互, 从而得到录制文件的结构和路径 等信息。 S206. Restore the recorded failed program by using the program recovery information. In the preferred embodiment, the program recovery information is obtained by scanning, so as to repair the damaged program, and the problem that the recorded program in the related art cannot be played normally or cannot perform the trick operation is solved, and the capacity of the terminal is improved. Wrongness and stability with the business operations system. In addition, it saves time and effort for the user to record twice. Preferably, the step of scanning all the files corresponding to the program that failed to be recorded to obtain the program recovery information includes: obtaining, by the scanning, parameter information of all the fragment files of the program that failed to be recorded, wherein the parameter information The method includes: the number of the fragmentation files, a playback start time and a duration of each of the fragmentation files; and the parameter information is recorded in a fragmentation index file of the program that fails to be recorded, where the program The recovery information includes the slice index file. In the preferred embodiment, the parameter information of the obtained fragment file can be effectively utilized to recover the program damaged by the fragment file. Preferably, the step of scanning all the files corresponding to the program that failed to be recorded to obtain the program recovery information further includes: obtaining, by the scanning, playing information of each key frame of each of the fragment files, where The play information includes: a play time stamp PTS, a position and a size; and the play information of all the key frames of each of the slice files are respectively recorded into a key frame index file corresponding to the slice file, wherein one of the points The slice file corresponds to one of the key frame index files, and the program recovery information further includes a key frame index file. In the preferred embodiment, the obtained fragment file and key frame index file can be effectively utilized to recover the corrupted program of the fragment file and the key frame index file. Preferably, the step of scanning all the files corresponding to the program that failed to record to obtain program recovery information further includes: a code stream of a beginning portion of the first fragment file and an end portion of a last one of the fragments Scanning the code stream to obtain the first key frame and the last one of the key frames; calculating a difference between the PTS of the first key frame and the last key frame to obtain the program of the recording failure Play duration; record the play duration into the slice index file. In the preferred embodiment, the obtained fragment file and key frame index file can be effectively utilized to recover the corrupted program of the fragment file and the key frame index file. Preferably, the step of scanning all the files corresponding to the program that failed to be recorded to obtain the program recovery information further includes: calculating a file size of all the fragment files by using a system function; and calculating a file size of all the fragment files. And obtaining a size of the program that the recording failed; recording the size of the program that failed to be recorded into the fragment index file. In the preferred embodiment, the obtained fragment file can be effectively utilized to recover the program whose fragment file is corrupted. Preferably, the step of scanning all the files corresponding to the recorded failed program to obtain the program recovery information further comprises: reading the PTS of the first key frame in each of the key frame index files; The PTS record is recorded in the slice index file. In the preferred embodiment, the obtained fragment file and key frame index file can be effectively utilized to recover the corrupted program of the fragment file and the key frame index file. Preferably, the step of restoring the recorded failed program using the program recovery information comprises: playing the recorded failed program by using the fragment index file. In the preferred embodiment, the obtained fragment file can be effectively utilized to recover the program whose fragment file is corrupted. Preferably, since the file to be scanned is large, a file that is normally recorded can be marked to indicate that the recorded file is complete, and such a file does not need to be scanned. When a recording process ends normally, a flag like this is set. Therefore, when a recorded file is to be played, it is found that there is no such mark, and the recorded file is repaired. Therefore, before determining whether there is a program that fails to be recorded by scanning the recorded program, the method further includes: detecting whether the recorded program is set with a normal recording mark, and if present, not scanning the recorded program. Embodiment 2 FIG. 3 is a schematic structural diagram of a device for restoring an IPTV recorded program according to an embodiment of the present invention, which includes: a scanning module 302, a repair module 304 in communication with the scanning module 302, and a communication module 304 The TS packet demultiplexing module 306, the system module 308 in communication with the TS packet demultiplexing module 306. The system module 308 is configured to interact with a function of the system to obtain information such as a structure and a path of the recorded file.
TS包解复用模块 306设置为负责解复用 TS包, 分析出每个帧的类型, 每个帧的 PTS、 位移和大小。 扫描模块 302设置为对整个录制的节目进行扫描, 对于录制失败的节目, 将调用 修复模块 304进行修复。 修复模块 304设置为通过调用系统模块和 TS包解复用模块 306,将修复的结果写 入文件。 在本优选的实施例中, 修复模块 304的修复步骤可以参考实施例 1, 在此不再赘 述。 通过扫描得到录制失败的节目, 并进行修复, 解决了相关技术中录制的节目无法 正常播放或无法进行特技操作的问题, 提高了终端的容错性以及与业务运营系统之间 的稳定性。 此外, 对于用户来说, 还节省了因二次录制而花费的时间和精力。 实施例 3 图 4是根据本发明实施例的 IPTV录制的节目的恢复方法的另一种优选的流程图, 其包括如下步骤: The TS packet demultiplexing module 306 is arranged to be responsible for demultiplexing the TS packets, analyzing the type of each frame, the PTS, the displacement and the size of each frame. The scanning module 302 is arranged to scan the entire recorded program, and for the program that failed to be recorded, the repair module 304 will be called to repair. The repair module 304 is arranged to write the result of the repair to the file by invoking the system module and the TS packet demultiplexing module 306. In the preferred embodiment, the repairing step of the repair module 304 can be referred to the embodiment 1, and details are not described herein again. The program that failed to be recorded is scanned and repaired, and the problem that the recorded program in the related art cannot be played normally or cannot perform the trick operation is solved, and the fault tolerance of the terminal and the stability with the business operation system are improved. In addition, it saves time and effort for the user to record twice. Example 3 FIG. 4 is another preferred flowchart of a method for restoring a program recorded by an IPTV according to an embodiment of the present invention, which includes the following steps:
S402, 对所有录制的节目进行扫描。 S402, scanning all recorded programs.
S404, 查找是否有录制失败的节目; 若存在, 则转至步骤 S406; 否则, 则转至步 骤 S418。 S404. Find whether there is a program that fails to record; if yes, go to step S406; otherwise, go to step S418.
S406, 对于录制失败的节目, 进入其文件夹, 对所有的文件进行扫描, 记录下所 有分片文件和其索引文件的名字 file_namesS406, for the program that failed to record, enter its folder, scan all the files, and record the names of all the fragment files and their index files file_nam es .
S408, 对第一个分片文件的开始部分的码流和最后一个分片的结尾处的码流进行 扫描, 分别找出第一个关键帧和最后一个关键帧。 计算上述两个关键帧的 PTS之差得 到节目的播放时长 totalTime。 S408: Scan the code stream at the beginning of the first slice file and the code stream at the end of the last slice to find the first key frame and the last key frame respectively. The difference between the PTSs of the above two key frames is calculated as the total duration of the program's play time.
S410, 调用系统函数计算出这个节目中所有分片的大小, 计算所有分片文件的大 小之和得到录制节目的大小 file_length。 S410, the calling system function calculates the size of all the fragments in the program, calculates the sum of the sizes of all the fragment files, and obtains the size of the recorded program file_length.
S412, 扫描最后一个分片文件, 记录下每个关键帧的 PTS、 位置和大小, 并写入 到最后一个分片文件的关键帧索引文件中。如果这个索引文件有内容, 就将其覆盖掉。 S414, 读取每个关键帧索引文件, 并记录第一个关键帧的 PTS。 S412, scanning the last slice file, recording the PTS, position and size of each key frame, and writing to the key frame index file of the last slice file. If the index file has content, it will be overwritten. S414, reading each key frame index file, and recording the PTS of the first key frame.
S416, 将 S402-S412中的信息记录到分片索引文件中。 S418, 扫描完成。 在本优选的实施例中, 通过更新后的分片索引文件和关键帧索引文件来播放损坏 的节目, 从而达到恢复的目的, 解决了相关技术中录制的节目无法正常播放或无法进 行特技操作的问题, 提高了终端的容错性以及与业务运营系统之间的稳定性。 此外, 对于用户来说, 还节省了因二次录制而花费的时间和精力。 实施例 4 图 5是根据本发明实施例的 IPTV录制的节目的恢复装置的另一种优选的结构图, 其包括: 判断单元 502, 设置为通过对所录制的节目进行扫描来判断是否存在录制失 败的节目; 扫描单元 504, 与判断单元 502通信, 设置为在存在所述录制失败的节目 时, 对所述录制失败的节目对应的所有文件进行扫描得到节目恢复信息; 恢复单元 506, 与扫描单元 504通信, 设置为使用所述节目恢复信息对所述录制失败的节目进行 恢复。 在本优选的实施例中, 通过扫描得到节目恢复信息, 以便修复损坏的节目, 解决 了相关技术中录制的节目无法正常播放或无法进行特技操作的问题, 提高了终端的容 错性以及与业务运营系统之间的稳定性。 此外, 对于用户来说, 还节省了因二次录制 而花费的时间和精力。 优选的, 所述扫描单元 504包括: 第一扫描模块, 设置为通过所述扫描得到所述 录制失败的节目的所有分片文件的参数信息, 其中, 所述参数信息包括: 所述分片文 件的数量、 每个所述分片文件的播放起始时间和时长; 第一记录模块, 与第一扫描模 块通信, 设置为将所述参数信息记录到所述录制失败的节目的分片索引文件中,其中, 所述节目恢复信息包括所述分片索引文件。 在本优选的实施例中, 可以有效地利用得 到的分片文件的参数信息对分片文件损坏的节目进行恢复。 优选的, 所述扫描单元 504还包括: 第二扫描模块, 设置为通过所述扫描得到每 个所述分片文件的每个关键帧的播放信息, 其中, 所述播放信息包括: 播放时间标记 PTS、 位置和大小; 第二记录模块, 与第二扫描模块通信, 设置为将每个所述分片文 件的所有关键帧的播放信息分别记录到与该分片文件对应的关键帧索引文件中,其中, 一个所述分片文件对应一个所述关键帧索引文件, 所述节目恢复信息还包括关键帧索 引文件。 在本优选的实施例中, 可以有效地利用得到的分片文件和关键帧索引文件对 分片文件和关键帧索引文件损坏的节目进行恢复。 优选的, 扫描单元 504对所述录制失败的节目对应的所有文件进行扫描得到节目 恢复信息的步骤还包括: 对第一个所述分片文件的开始部分的码流和最后一个所述分 片的结束部分的码流进行扫描, 得到第一个所述关键帧和最后一个所述关键帧; 计算 所述第一个关键帧和所述最后一个关键帧的 PTS的差值得到所述录制失败的节目的播 放时长; 将所述播放时长记录到所述分片索引文件中。 在本优选的实施例中, 可以有 效地利用得到的分片文件和关键帧索引文件对分片文件和关键帧索引文件损坏的节目 进行恢复。 优选的, 扫描单元 504对所述录制失败的节目对应的所有文件进行扫描得到节目 恢复信息的步骤还包括: 通过系统函数计算所有所述分片文件的文件大小; 计算所有 所述分片文件的文件大小之和得到所述录制失败的节目的大小; 将所述录制失败的节 目的大小记录到所述分片索引文件中。 在本优选的实施例中, 可以有效地利用得到的 分片文件对分片文件损坏的节目进行恢复。 优选的, 扫描单元 504对所述录制失败的节目对应的所有文件进行扫描得到节目 恢复信息的步骤还包括: 读取每个所述关键帧索引文件中的第一个关键帧的 PTS; 将 读取的所述 PTS记录到所述分片索引文件中。 在本优选的实施例中, 可以有效地利用 得到的分片文件和关键帧索引文件对分片文件和关键帧索引文件损坏的节目进行恢 复。 优选的, 恢复单元 506使用所述节目恢复信息对所述录制失败的节目进行恢复的 步骤包括: 使用所述分片索引文件来播放所述录制失败的节目。在本优选的实施例中, 可以有效地利用得到的分片文件对分片文件损坏的节目进行恢复。 优选的, 由于要扫描的文件会很大,所以可以对正常录制完成的文件作一个标记, 用于说明这个录制的文件是完整的, 这样的文件就不需要扫描了。 当一个录制的过程 正常结束后, 就设置一个这样的标记。 所以, 当要播放某个录制的文件时, 发现没有 这样的标记, 就要对这个录制的文件进行修复。 因此, 在通过对所录制的节目进行扫描来判断是否存在录制失败的节目之前, 还 包括: 判断单元 502检测所录制的节目是否设置有正常录制标记, 若存在, 则不对该 录制的节目进行扫描。 显然, 本领域的技术人员应该明白, 上述的本发明的各模块或各步骤可以用通用 的计算装置来实现, 它们可以集中在单个的计算装置上, 或者分布在多个计算装置所 组成的网络上, 可选地, 它们可以用计算装置可执行的程序代码来实现, 从而, 可以 将它们存储在存储装置中由计算装置来执行, 并且在某些情况下, 可以以不同于此处 的顺序执行所示出或描述的步骤, 或者将它们分别制作成各个集成电路模块, 或者将 它们中的多个模块或步骤制作成单个集成电路模块来实现。 这样, 本发明不限制于任 何特定的硬件和软件结合。 以上所述仅为本发明的优选实施例而已, 并不用于限制本发明, 对于本领域的技 术人员来说, 本发明可以有各种更改和变化。 凡在本发明的精神和原则之内, 所作的 任何修改、 等同替换、 改进等, 均应包含在本发明的保护范围之内。 S416, the information in S402-S412 is recorded into the fragment index file. S418, the scan is completed. In the preferred embodiment, the damaged program is played by the updated fragment index file and the key frame index file, thereby achieving the purpose of recovery, and solving the problem that the recorded program in the related art cannot be played normally or cannot perform the trick operation. The problem is to improve the fault tolerance of the terminal and the stability with the business operation system. In addition, it saves time and effort for the user to record twice. Embodiment 4 FIG. 5 is another preferred structural diagram of a device for restoring an IPTV recorded program according to an embodiment of the present invention, which includes: a determining unit 502 configured to determine whether a recording exists by scanning a recorded program. a failed program; the scanning unit 504, in communication with the determining unit 502, configured to scan all files corresponding to the program that failed to be recorded to obtain program recovery information when the program that fails to be recorded is present; 506. Communicate with the scanning unit 504, configured to use the program recovery information to restore the recorded failed program. In the preferred embodiment, the program recovery information is obtained by scanning to repair the damaged program, and the problem that the recorded program in the related art cannot be played normally or cannot perform the trick operation is solved, and the fault tolerance of the terminal and the business operation are improved. Stability between systems. In addition, it saves time and effort for the user to record twice. Preferably, the scanning unit 504 includes: a first scanning module, configured to obtain, by using the scanning, parameter information of all the fragment files of the program that fails to be recorded, where the parameter information includes: the fragment file The number, the playback start time and the duration of each of the fragment files; the first recording module, in communication with the first scanning module, configured to record the parameter information to the fragment index file of the program that failed to be recorded The program recovery information includes the fragment index file. In the preferred embodiment, the parameter information of the obtained fragment file can be effectively utilized to recover the program damaged by the fragment file. Preferably, the scanning unit 504 further includes: a second scanning module, configured to obtain, by using the scanning, play information of each key frame of each of the fragment files, where the play information includes: a play time mark PTS, location and size; the second recording module is configured to communicate with the second scanning module, and set the playback information of all the key frames of each of the fragment files to the key frame index file corresponding to the fragment file. One of the fragment files corresponds to one of the key frame index files, and the program recovery information further includes a key frame index file. In the preferred embodiment, the obtained fragment file and key frame index file can be effectively utilized to recover the corrupted program of the fragment file and the key frame index file. Preferably, the scanning unit 504 scans all the files corresponding to the program that failed to be recorded to obtain program recovery information, and further includes: a code stream of a beginning portion of the first fragment file and a last one of the fragments The end of the code stream is scanned to obtain the first of the key frame and the last of the key frames; calculating the difference between the PTS of the first key frame and the last key frame to obtain the recording failure The playing duration of the program; recording the playing duration into the fragment index file. In the preferred embodiment, the obtained fragment file and key frame index file can be effectively utilized to recover the corrupted program of the fragment file and the key frame index file. Preferably, the scanning unit 504 scans all the files corresponding to the program that failed to be recorded to obtain program recovery information, and further includes: calculating, by using a system function, a file size of all the fragment files; and calculating all the fragment files. The sum of the file sizes is the size of the program that failed to be recorded; the size of the program that failed to be recorded is recorded in the slice index file. In the preferred embodiment, the obtained fragment file can be effectively utilized to recover the program whose fragment file is corrupted. Preferably, the scanning unit 504 scans all the files corresponding to the recorded failed program to obtain the program recovery information, further comprising: reading the PTS of the first key frame in each of the key frame index files; The PTS is taken into the fragment index file. In the preferred embodiment, the obtained fragment file and key frame index file can be effectively utilized to recover the corrupted program of the fragment file and the key frame index file. Preferably, the recovering unit 506 recovering the recorded failed program by using the program recovery information comprises: playing the recorded failed program by using the fragment index file. In the preferred embodiment, the obtained fragment file can be effectively utilized to recover the program whose fragment file is corrupted. Preferably, since the file to be scanned is large, a file that is normally recorded can be marked to indicate that the recorded file is complete, and such a file does not need to be scanned. When a recording process ends normally, a flag like this is set. Therefore, when a recorded file is to be played, it is found that there is no such mark, and the recorded file is repaired. Therefore, before determining whether there is a program that fails to be recorded by scanning the recorded program, the method further includes: the determining unit 502 detecting whether the recorded program is set with a normal recording mark, and if present, not scanning the recorded program. . Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general-purpose computing device, which can be concentrated on a single computing device or distributed over a network composed of multiple computing devices. Alternatively, they may be implemented by program code executable by the computing device, such that they may be stored in the storage device by the computing device and, in some cases, may be different from the order herein. The steps shown or described are performed, or they are separately fabricated into individual integrated circuit modules, or a plurality of modules or steps are fabricated as a single integrated circuit module. Thus, the invention is not limited to any specific combination of hardware and software. The above is only the preferred embodiment of the present invention, and is not intended to limit the present invention, and various modifications and changes can be made to the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and scope of the present invention are intended to be included within the scope of the present invention.

Claims

权 利 要 求 书 Claim
1. 一种网络电视 IPTV录制的节目的恢复方法, 包括: 1. A method for recovering a program recorded by an IPTV network, comprising:
通过对所录制的节目进行扫描来判断是否存在录制失败的节目; 若存在, 则对所述录制失败的节目对应的所有文件进行扫描得到节目恢复 信息;  Determining whether there is a program that fails to be recorded by scanning the recorded program; if present, scanning all files corresponding to the program that failed to be recorded to obtain program recovery information;
使用所述节目恢复信息对所述录制失败的节目进行恢复。  The program that failed to be recorded is restored using the program recovery information.
2. 根据权利要求 1所述的方法, 其中, 对所述录制失败的节目对应的所有文件进 行扫描得到节目恢复信息的步骤包括: 2. The method according to claim 1, wherein the step of scanning all files corresponding to the program that failed to be recorded to obtain program recovery information comprises:
通过所述扫描得到所述录制失败的节目的所有分片文件的参数信息,其中, 所述参数信息包括: 所述分片文件的数量、 每个所述分片文件的播放起始时间 和时长;  The parameter information of all the fragment files of the program that failed to be recorded is obtained by the scanning, where the parameter information includes: the number of the fragment files, the playback start time and the duration of each of the fragment files. ;
将所述参数信息记录到所述录制失败的节目的分片索引文件中, 其中, 所 述节目恢复信息包括所述分片索引文件。  And recording the parameter information into a fragment index file of the program that failed to be recorded, wherein the program recovery information includes the fragment index file.
3. 根据权利要求 2所述的方法, 其中, 对所述录制失败的节目对应的所有文件进 行扫描得到节目恢复信息的步骤还包括: The method according to claim 2, wherein the step of scanning all the files corresponding to the program that failed to be recorded to obtain program recovery information further includes:
通过所述扫描得到每个所述分片文件的每个关键帧的播放信息, 其中, 所 述播放信息包括: 播放时间标记 PTS、 位置和大小;  The playing information of each key frame of each of the fragment files is obtained by the scanning, where the playing information includes: a playing time mark PTS, a position and a size;
将每个所述分片文件的所有关键帧的播放信息分别记录到与该分片文件对 应的关键帧索引文件中, 其中, 一个所述分片文件对应一个所述关键帧索引文 件, 所述节目恢复信息还包括关键帧索引文件。  And playing the play information of all the key frames of each of the slice files into a key frame index file corresponding to the slice file, where one of the slice files corresponds to one of the key frame index files, The program recovery information also includes a key frame index file.
4. 根据权利要求 2所述的方法, 其中, 对所述录制失败的节目对应的所有文件进 行扫描得到节目恢复信息的步骤还包括: 4. The method according to claim 2, wherein the step of scanning all the files corresponding to the program that failed to be recorded to obtain program recovery information further comprises:
对第一个所述分片文件的开始部分的码流和最后一个所述分片的结束部分 的码流进行扫描, 得到第一个所述关键帧和最后一个所述关键帧;  Scanning the code stream of the beginning portion of the first fragment file and the code stream of the end portion of the last fragment to obtain the first key frame and the last key frame;
计算所述第一个关键帧和所述最后一个关键帧的 PTS的差值得到所述录制 失败的节目的播放时长;  Calculating a difference between the PTS of the first key frame and the last key frame to obtain a play duration of the program that failed to be recorded;
将所述播放时长记录到所述分片索引文件中。 根据权利要求 2所述的方法, 其中, 对所述录制失败的节目对应的所有文件进 行扫描得到节目恢复信息的步骤还包括: Recording the play duration into the slice index file. The method according to claim 2, wherein the step of scanning all the files corresponding to the program that failed to be recorded to obtain program recovery information further includes:
通过系统函数计算所有所述分片文件的文件大小;  Calculating the file size of all the fragment files by a system function;
计算所有所述分片文件的文件大小之和得到所述录制失败的节目的大小; 将所述录制失败的节目的大小记录到所述分片索引文件中。 根据权利要求 3所述的方法, 其中, 对所述录制失败的节目对应的所有文件进 行扫描得到节目恢复信息的步骤还包括:  Calculating a sum of file sizes of all the fragment files to obtain a size of the program that failed to be recorded; and recording a size of the program that failed to be recorded into the fragment index file. The method according to claim 3, wherein the step of scanning all the files corresponding to the program that failed to be recorded to obtain program recovery information further comprises:
读取每个所述关键帧索引文件中的第一个关键帧的 PTS;  Reading the PTS of the first key frame in each of the key frame index files;
将读取的所述 PTS记录到所述分片索引文件中。 根据权利要求 2至 6中任一项所述的方法, 其中, 使用所述节目恢复信息对所 述录制失败的节目进行恢复的步骤包括:  The read PTS is recorded into the slice index file. The method according to any one of claims 2 to 6, wherein the step of recovering the recorded failed program using the program restoration information comprises:
使用所述分片索引文件来播放所述录制失败的节目。 一种网络电视 IPTV录制的节目的恢复装置, 包括:  The slice index file is used to play the program that failed to be recorded. A device for recovering a program recorded by a network television IPTV, comprising:
判断单元, 设置为通过对所录制的节目进行扫描来判断是否存在录制失败 的节目;  a determining unit, configured to determine whether there is a program that fails to be recorded by scanning the recorded program;
扫描单元, 设置为在存在所述录制失败的节目时, 对所述录制失败的节目 对应的所有文件进行扫描得到节目恢复信息;  a scanning unit, configured to scan all files corresponding to the program that failed to be recorded to obtain program recovery information when the program that fails to be recorded is present;
恢复单元,设置为使用所述节目恢复信息对所述录制失败的节目进行恢复。 根据权利要求 8所述的装置, 其中, 所述扫描单元包括: 第一扫描模块, 设置为通过所述扫描得到所述录制失败的节目的所有分片 文件的参数信息, 其中, 所述参数信息包括: 所述分片文件的数量、 每个所述 分片文件的播放起始时间和时长;  And a recovery unit configured to restore the recorded failed program using the program recovery information. The device according to claim 8, wherein the scanning unit comprises: a first scanning module, configured to obtain parameter information of all the fragment files of the program that failed to be recorded by the scanning, wherein the parameter information The method includes: the number of the fragment files, a playback start time and a duration of each of the fragment files;
第一记录模块, 设置为将所述参数信息记录到所述录制失败的节目的分片 索引文件中, 其中, 所述节目恢复信息包括所述分片索引文件。 根据权利要求 9所述的装置, 其中, 所述扫描单元还包括: 第二扫描模块, 设置为通过所述扫描得到每个所述分片文件的每个关键帧 的播放信息, 其中, 所述播放信息包括: 播放时间标记 PTS、 位置和大小; 第二记录模块, 设置为将每个所述分片文件的所有关键帧的播放信息分别 记录到与该分片文件对应的关键帧索引文件中, 其中, 一个所述分片文件对应 一个所述关键帧索引文件, 所述节目恢复信息还包括关键帧索引文件。 The first recording module is configured to record the parameter information into a fragment index file of the program that failed to be recorded, where the program recovery information includes the fragment index file. The apparatus according to claim 9, wherein the scanning unit further comprises: a second scanning module, configured to obtain, by the scanning, playback information of each key frame of each of the fragment files, wherein The play information includes: play time stamp PTS, position and size; a second recording module, configured to record the play information of all the key frames of each of the slice files into a key frame index file corresponding to the slice file, where one of the slice files corresponds to one The key frame index file, the program recovery information further includes a key frame index file.
PCT/CN2011/082342 2010-11-17 2011-11-17 Method and device for restoring program recoded through iptv WO2012065559A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201010549116.2 2010-11-17
CN2010105491162A CN101998160A (en) 2010-11-17 2010-11-17 Method and device for recovering network television-recorded program

Publications (1)

Publication Number Publication Date
WO2012065559A1 true WO2012065559A1 (en) 2012-05-24

Family

ID=43787623

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2011/082342 WO2012065559A1 (en) 2010-11-17 2011-11-17 Method and device for restoring program recoded through iptv

Country Status (2)

Country Link
CN (1) CN101998160A (en)
WO (1) WO2012065559A1 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102845041B (en) * 2011-04-21 2015-11-25 华为技术有限公司 Based on multi code Rate of Chinese character positioning playing method, the equipment and system of HTML (Hypertext Markup Language)
CN108024138A (en) * 2016-10-31 2018-05-11 杭州海康威视数字技术股份有限公司 A kind of method for packing and device
CN113938741B (en) * 2021-12-08 2023-08-11 聚好看科技股份有限公司 Server and media asset playing exception handling method

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070130498A1 (en) * 2005-12-01 2007-06-07 Nokia Corporation Time-shifted presentation of media streams
CN101137027A (en) * 2006-11-23 2008-03-05 中兴通讯股份有限公司 Media slicing memory method
CN101202908A (en) * 2007-07-18 2008-06-18 深圳市同洲电子股份有限公司 Method, system for complementing lose data and network system
CN101420603A (en) * 2008-09-05 2009-04-29 中兴通讯股份有限公司 Method for implementing media distribution, positioning by segmented memory and stream media system thereof

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070130498A1 (en) * 2005-12-01 2007-06-07 Nokia Corporation Time-shifted presentation of media streams
CN101137027A (en) * 2006-11-23 2008-03-05 中兴通讯股份有限公司 Media slicing memory method
CN101202908A (en) * 2007-07-18 2008-06-18 深圳市同洲电子股份有限公司 Method, system for complementing lose data and network system
CN101420603A (en) * 2008-09-05 2009-04-29 中兴通讯股份有限公司 Method for implementing media distribution, positioning by segmented memory and stream media system thereof

Also Published As

Publication number Publication date
CN101998160A (en) 2011-03-30

Similar Documents

Publication Publication Date Title
EP1329108B1 (en) System and method of processing mpeg streams for file index insertion
US8879896B2 (en) Method and apparatus to facilitate the efficient implementation of trick modes in a personal video recording system
KR101533174B1 (en) Method of processing a sequence of coded video frames
US8014484B2 (en) Stream data recording device, stream data editing device, stream data reproducing device, stream data recording method, and stream data reproducing method
CN101322410A (en) Method and device for detecting video data error
WO2012065559A1 (en) Method and device for restoring program recoded through iptv
CN1201335A (en) Synchronous deviation control apparatus and method thereof
US8254764B2 (en) Recording apparatus, image reproducing apparatus, and special reproduction method therefor
US20080235401A1 (en) Method of storing media data delivered through a network
CN102231803B (en) Fault tolerant method for supporting TS streaming media file
US20130004146A1 (en) Recording device and dubbing method
JP4763589B2 (en) Playback device and playback method thereof
JPWO2006075457A1 (en) Recording device
CN102231804B (en) Fault tolerance method supporting PS streaming media file
JP2004096474A (en) Reproducing method and system of moving picture data
CN102857812A (en) Fault-tolerant method and fault-tolerant system both supporting TS (transport stream) streaming medium files
JP5191294B2 (en) Information processing apparatus and program
US8571392B2 (en) Apparatus for video recording and reproducing, and method for trick play of video
JP2005348078A (en) Video recorder
JP2004253052A (en) Information recording medium, and information recording device
JP2009081744A (en) Picture work material playback device and picture work material playback method
JP2005026990A (en) Digital recording and reproducing device
JP5120479B2 (en) Data signal recording apparatus and data signal reproducing apparatus
JP5120322B2 (en) Data signal recording apparatus and data signal reproducing apparatus
JP2006211577A (en) Digital broadcast accumulating and reproducing apparatus and method

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 11840849

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 11840849

Country of ref document: EP

Kind code of ref document: A1