KR101316579B1 - Mp4 file configuring device and restoring device, mp4 file configuring method and restoring method - Google Patents

Mp4 file configuring device and restoring device, mp4 file configuring method and restoring method Download PDF

Info

Publication number
KR101316579B1
KR101316579B1 KR1020120005039A KR20120005039A KR101316579B1 KR 101316579 B1 KR101316579 B1 KR 101316579B1 KR 1020120005039 A KR1020120005039 A KR 1020120005039A KR 20120005039 A KR20120005039 A KR 20120005039A KR 101316579 B1 KR101316579 B1 KR 101316579B1
Authority
KR
South Korea
Prior art keywords
file
box
frame
media data
data
Prior art date
Application number
KR1020120005039A
Other languages
Korean (ko)
Other versions
KR20130084345A (en
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 (주)피타소프트
Priority to KR1020120005039A priority Critical patent/KR101316579B1/en
Publication of KR20130084345A publication Critical patent/KR20130084345A/en
Application granted granted Critical
Publication of KR101316579B1 publication Critical patent/KR101316579B1/en

Links

Images

Classifications

    • GPHYSICS
    • G11INFORMATION STORAGE
    • G11BINFORMATION STORAGE BASED ON RELATIVE MOVEMENT BETWEEN RECORD CARRIER AND TRANSDUCER
    • G11B27/00Editing; Indexing; Addressing; Timing or synchronising; Monitoring; Measuring tape travel
    • G11B27/02Editing, e.g. varying the order of information signals recorded on, or reproduced from, record carriers
    • G11B27/031Electronic editing of digitised analogue information signals, e.g. audio or video signals
    • GPHYSICS
    • G11INFORMATION STORAGE
    • G11BINFORMATION STORAGE BASED ON RELATIVE MOVEMENT BETWEEN RECORD CARRIER AND TRANSDUCER
    • G11B20/00Signal processing not specific to the method of recording or reproducing; Circuits therefor
    • G11B20/10Digital recording or reproducing
    • G11B20/10009Improvement or modification of read or write signals
    • G11B20/10037A/D conversion, D/A conversion, sampling, slicing and digital quantisation or adjusting parameters thereof
    • GPHYSICS
    • G11INFORMATION STORAGE
    • G11BINFORMATION STORAGE BASED ON RELATIVE MOVEMENT BETWEEN RECORD CARRIER AND TRANSDUCER
    • G11B20/00Signal processing not specific to the method of recording or reproducing; Circuits therefor
    • G11B20/10Digital recording or reproducing
    • G11B20/12Formatting, e.g. arrangement of data block or words on the record carriers
    • GPHYSICS
    • G11INFORMATION STORAGE
    • G11BINFORMATION STORAGE BASED ON RELATIVE MOVEMENT BETWEEN RECORD CARRIER AND TRANSDUCER
    • G11B27/00Editing; Indexing; Addressing; Timing or synchronising; Monitoring; Measuring tape travel
    • G11B27/10Indexing; Addressing; Timing or synchronising; Measuring tape travel
    • GPHYSICS
    • G11INFORMATION STORAGE
    • G11BINFORMATION STORAGE BASED ON RELATIVE MOVEMENT BETWEEN RECORD CARRIER AND TRANSDUCER
    • G11B20/00Signal processing not specific to the method of recording or reproducing; Circuits therefor
    • G11B20/10Digital recording or reproducing
    • G11B2020/10935Digital recording or reproducing wherein a time constraint must be met
    • G11B2020/10944Real-time recording or reproducing, e.g. for ensuring seamless playback of AV data
    • GPHYSICS
    • G11INFORMATION STORAGE
    • G11BINFORMATION STORAGE BASED ON RELATIVE MOVEMENT BETWEEN RECORD CARRIER AND TRANSDUCER
    • G11B20/00Signal processing not specific to the method of recording or reproducing; Circuits therefor
    • G11B20/10Digital recording or reproducing
    • G11B20/12Formatting, e.g. arrangement of data block or words on the record carriers
    • G11B2020/1264Formatting, e.g. arrangement of data block or words on the record carriers wherein the formatting concerns a specific kind of data

Abstract

본 발명은, 비디오/오디오 데이터(미디어 데이터)를 ISO/IEC 14496-12 규격에 따른 MP4 파일 포맷으로 변환하여 저장하는 MP4 파일 구성 장치로서: 미디어 데이터를 획득하는 미디어 획득부; 상기 미디어 데이터를 소정의 샘플 단위로 분할하고 각 샘플마다 적어도 상기 샘플의 타임 스탬프 및 사이즈를 나타내는 부가 정보를 추가하여 프레임으로서 mdat box에 기록하고, 상기 미디어 데이터를 MP4 파일 포맷으로 구성하는 데에 필요한 메타 데이터를 생성하여 메모리에 기록하고, 또한 상기 메타 데이터 중 적어도 일부를 MP4 파일에 포함되는 특정 box에 실시간으로 기록하고, 상기 미디어 획득부로부터 상기 미디어 데이터의 획득이 종료되면 당시까지 상기 mdat box에 저장된 상기 미디어 데이터에 대한 최종 메타 데이터로 상기 moov box를 구성하여 상기 MP4 파일의 끝부분에 기록하는 MP4 파일 구성부; 및 파일 저장부를 포함한다.An apparatus for constructing an MP4 file for converting and storing video / audio data (media data) into an MP4 file format according to ISO / IEC 14496-12 standard, comprising: a media acquisition unit for acquiring media data; Necessary for dividing the media data into predetermined sample units, adding additional information indicating at least a time stamp and a size of the sample to each sample, recording the data in a mdat box as a frame, and organizing the media data into an MP4 file format. The metadata is generated and recorded in a memory, and at least a part of the metadata is recorded in a specific box included in an MP4 file in real time, and when the acquisition of the media data from the media acquisition unit is completed, the metadata is stored in the mdat box until then. An MP4 file constructing unit for constructing the moov box as the final meta data of the stored media data and recording at the end of the MP4 file; And a file storage unit.

Description

MP4 파일 구성 장치 및 복구 장치, MP4 파일 구성 방법 및 복구 방법{MP4 FILE CONFIGURING DEVICE AND RESTORING DEVICE, MP4 FILE CONFIGURING METHOD AND RESTORING METHOD}MP4 FILE CONFIGURING DEVICE AND RESTORING DEVICE, MP4 FILE CONFIGURING METHOD AND RESTORING METHOD}

본 발명은 MP4 파일 구성 장치 및 MP4 파일 복구 장치, 그리고 MP4 파일 구성 방법 및 MP4 파일 복구 방법에 관한 것으로서, 비디오/오디오 데이터를 MP4 파일 포맷으로 구성하여 저장하는 장치 및 이 장치에 의해 저장된 MP4 파일이 손상된 경우에 이 손상된 MP4 파일을 재생 가능하게 복구하는 장치, 그리고 이들 장치에 의해 MP4 파일을 구성하여 저장하는 방법 및 손상된 MP4 파일을 복구하는 방법에 관한 것이다.The present invention relates to a device for constructing an MP4 file, an apparatus for recovering an MP4 file, and a method for constructing an MP4 file and a method for recovering an MP4 file. The present invention relates to a device for organizing and storing video / audio data in an MP4 file format, and an MP4 file stored by the device. The present invention relates to a device for recovering a damaged MP4 file if it is damaged, a method for constructing and storing an MP4 file by these devices, and a method for recovering a damaged MP4 file.

MPEG(Moving Pictures Experts Group)은 MPEG-4를 개발하였는데, 이것은 동영상 및 음향을 포함하는 멀티미디어 프리젠테이션(multimedia presentation)을 구현하기 위한 멀티미디어 압축 표준이다. MPEG-4 사양은 비디오/오디오 데이터를 위한 일련의 코딩 툴(coding tool)을 정의하고 코딩된 음향-영상 객체의 문법적인 기술(syntactic description)을 정의한다. Moving Pictures Experts Group (MPEG) has developed MPEG-4, a multimedia compression standard for implementing multimedia presentations including video and sound. The MPEG-4 specification defines a set of coding tools for video / audio data and defines a syntactic description of coded acoustic-visual objects.

MPEG-4를 위하여 특정된 파일 포맷은 "MP4"라고 불리는데, MP4 파일의 개략적인 구성은 도 1 또는 도 2에 예시된 바와 같다. The file format specified for MPEG-4 is called "MP4", and the schematic configuration of the MP4 file is as illustrated in FIG. 1 or 2.

MP4와 관련한 기술은 ISO/IEC 14496-12 ISO base media file format에 표현되어 있다. MP4에서 모든 데이터는 "box"라고 불리는 구조로 캡슐화된다. The MP4 technology is described in the ISO / IEC 14496-12 ISO base media file format. In MP4, all data is encapsulated in a structure called a "box."

기본적인 최상위 box로는 ftyp box, mdat box, moov box 등이 있다.Basic top level boxes include ftyp boxes, mdat boxes, and moov boxes.

- ftyp box : file type box라고도 불리며, 파일의 타입과 호환성 등을 표시한다.ftyp box: Also called a file type box, indicates the type and compatibility of the file.

- mdat box : media data box라고도 불리며, 실질적인 비디오/오디오 프레임 데이터(미디어 데이터)가 포함되는 부분이다.mdat box: Also called a media data box, this part contains actual video / audio frame data (media data).

- moov box : movie box라고도 불리며, 메타 데이터(meta data)가 포함되는 부분이다. MP4 파일의 최상위 수준에 저장된다(파일의 시작 또는 끝 부분의 가까이에 존재). 각 데이터들의 track이 포함되고, 각 track에는 데이터의 형식(비디오 데이터의 경우에는 codec 종류와 해상도를 나타내는 정보, 오디오 데이터의 경우에는 codec의 종류와 channel, sampling rate, bit per sample 등의 정보)이 저장된다. 또한, 각 비디오/오디오 프레임(sample) 데이터에 관련한 정보가 저장된다.
-moov box: Also called movie box, this part contains meta data. Stored at the top level of the MP4 file (near the beginning or end of the file). A track of each data is included, and each track includes a data format (information indicating codec type and resolution in the case of video data, and information such as codec type and channel, sampling rate, and bit per sample in case of audio data). Stored. In addition, information related to each video / audio frame data is stored.

이와 같이, MP4 포맷은 모든 프리젠테이션 레벨 정보(메타 데이터)를 비디오/오디오 데이터를 포함하는 멀티미디어 데이터(미디어 데이터)로부터 분리하고 이것을 파일 내의 하나의 내장된 구조에 추가하는데, 이 내장된 구조는 "moov box"라고 불린다. As such, the MP4 format separates all presentation level information (meta data) from multimedia data (media data), including video / audio data, and adds it to one embedded structure in the file, which is " moov box ".

메타 데이터가 분리된 미디어 데이터는 mdat box로서 구분되어 저장되며, 여기에 저장되는 미디어 데이터는 moov box를 참조하여 해석된다. The media data from which the meta data is separated is divided and stored as an mdat box, and the media data stored therein is interpreted with reference to the moov box.

전형적으로, 메타 데이터의 비율은 전체 MP4 파일 크기의 5% 내지 20%에 해당한다. MP4 파일과 같은 일반적인 트랙 지향 스트리밍 파일을 순차적 다운로드하여 재생하고자 할 때에는, 모든 메타 데이터가 미디어 데이터보다 우선하여 전송되어야 한다. Typically, the proportion of metadata corresponds to 5% to 20% of the total MP4 file size. In order to sequentially download and play a general track-oriented streaming file such as an MP4 file, all metadata must be transmitted in preference to the media data.

또한, MP4 파일 형식으로 영상을 저장하고자 할 때에는, 파일의 마지막에 메타 데이터를 반드시 생성하여 MP4 파일의 끝부분 등에 포함시켜야만 한다. In addition, when the video is to be stored in the MP4 file format, metadata must be generated at the end of the file and included in the end of the MP4 file.

이러한 MP4 파일 포맷을 이용함으로써 발생할 수 있는 문제점은, 전송되는 MP4 파일과 이를 수신하는 응용 프로그램이 서로 충돌을 일으키거나, 수신되는 MP4 파일을 저장 공간에 저장하는 중에 수신측의 파일 저장 용량 부족과 같은 어떠한 이유에 의하여 파일의 마지막에 포함된 moov box를 완전히 저장할 수 없었던 경우에는, 그동안 저장된 데이터까지도 사용할 수 없게 된다는 것이다.
Problems caused by using the MP4 file format may be caused by a conflict between the MP4 file to be transmitted and an application program receiving the same, or insufficient file storage capacity at the receiving side while storing the received MP4 file in a storage space. If for some reason the moov box contained at the end of the file could not be saved completely, the data stored in the meantime will not be available.

최근의 차량용 블랙박스와 같은 영상 촬영/저장 장치에서는 촬영된 영상을 이러한 MP4 파일 포맷으로 저장하고 있다. 이때, 미디어 데이터의 mdat box 뿐만 아니라 moov box가 완전히 저장되었을 때에만 영상의 재생이 가능하다는 MP4 파일의 특성상, 영상 저장의 단위(MP4 파일의 시간 단위의 크기)를 30초 또는 1분 등으로 세분화하고 있다. Recently, image capturing / storage devices such as vehicle black boxes store captured images in the MP4 file format. At this time, the MP4 file can be reproduced only when the moov box as well as the mdat box of the media data is completely stored. Therefore, the unit of image storage (size of the MP4 file in time units) is subdivided into 30 seconds or 1 minute. Doing.

하지만, 시간을 세분화하였다고 하더라도, 만일 영상이 실시간 저장되는 중에, 블랙박스의 전원 공급 중단 또는 차량 사고 발생 등에 의한 손상으로 mdat box나 moov box가 완전히 저장되지 못한 경우에는, 새로운 파일로서 저장되던 영상에 대한 부가 정보를 획득할 수 없기 때문에 이 영상을 재생할 수 없다는 문제점은 여전히 안고 있는 것이다. However, even if the time is subdivided, if the mdat box or the moov box is not completely stored due to the black box's power supply interruption or damage due to a vehicle accident while the image is being stored in real time, the image is stored as a new file. The problem of not being able to reproduce this video is still a problem because it cannot obtain additional information.

예를 들어, 영상 저장의 단위(세분화된 시간)가 30초인 경우에, 새로운 MP4 파일이 생성되어 영상이 저장되는 중에 20초 근방에서, 차량 사고가 발생하여 블랙박스가 손상되었다면, 20초 동안 촬영되어 저장되는 MP4 파일에 대해서는 moov box가 저장될 수 없었으므로, 이 20초의 영상은 재생할 수 없게 되는 것이다. For example, if the unit (segmentation time) of image storage is 30 seconds, a new MP4 file is generated and near 20 seconds while the image is being stored. Since the moov box could not be stored for the MP4 file to be stored and stored, this 20-second video cannot be reproduced.

특히, 차량 사고라는 것이, 사고 발생 시점으로부터 약 10초를 전후하여 나타나는 상황에 의존하여 발생하는 가능성이 크므로, 20초 동안의 영상 손실은 사고 발생의 정황을 분석할 가장 중요한 정보일 수 있는 것이다. In particular, since a vehicle accident is likely to occur depending on a situation appearing about 10 seconds from the time of the accident, the video loss during 20 seconds may be the most important information for analyzing the situation of the accident. .

따라서, 영상 저장이 중단되는 시점까지의 앞서 저장된 영상을 최대한 복구할 필요성이 대두하였다.
Therefore, there is a need to recover the previously stored image as far as possible until the image storage is stopped.

참고로서, 한국 공개 특허 2004-41174호 문헌을 살펴보면, MP4 파일의 mdat box에 기록되는 미디어 데이터를 세그먼트로 구분하고, 각 세그먼트마다를 "미디어 데이터-메타 데이터 쌍"의 형태로 구성하고, 각 메타 데이터는 해당 세그먼트의 미디어 데이터만을 특정하도록 작성되어 있다. For reference, referring to Korean Patent Laid-Open Publication No. 2004-41174, the media data recorded in the mdat box of the MP4 file is divided into segments, and each segment is configured in the form of "media data-meta data pair", and each meta The data is created to specify only the media data of the segment.

이 문헌의 progressive MP4 파일 포맷은 smp4 box(atom)마다 moov box와 mdat box를 포함하도록 구성하고 있다. 하지만, moov box와 mdat box는 최상위 레벨의 box(atom)로서, 어떠한 box도 moov box와 mdat box를 포함하고 있지는 않다. 따라서, 이러한 파일 포맷은 표준화된 MP4 파일 포맷의 규약을 따르지 않고 있는 것에 해당하며, 일반적인 MP4 파일 플레이어에서 재생이 불가능하다. 더욱이, 이러한 파일 포맷에 의한 MP4 파일은 네트워크를 통해 전송되거나 미디어 데이터를 이용하여 생성될 때, MP4 파일의 전체적인 크기가 증가한다는 문제점을 갖는다. The progressive MP4 file format of this document is configured to include a moov box and an mdat box for every smp4 box (atom). However, the moov box and the mdat box are top-level boxes (atoms), and none of the boxes include the moov box and the mdat box. Thus, this file format corresponds to not following the conventions of the standardized MP4 file format and cannot be played in a general MP4 file player. Moreover, the MP4 file by this file format has a problem that the overall size of the MP4 file increases when it is transmitted over a network or created using media data.

본 발명은 상술한 필요성을 감안하여 이루어진 것으로서, 영상을 촬영하거나 음향을 녹음하여 MP4 파일을 구성하여 저장하는 중에 파일을 마감하기 위하여 파일에 포함되어야할 moov box의 저장이 완료되지 않았거나 moov box가 완전하지 않더라도, 그동안 저장된 영상 또는 음향을 최대한 복구하여 재생할 수 있도록 지원하는 MP4 파일을 구성하고 이러한 MP4 파일을 복구할 수 있는 장치 및 방법 제공하고자 하는 것이다. SUMMARY OF THE INVENTION The present invention has been made in view of the above-described necessity, and the recording of the moov box to be included in the file is not completed or the moov box is not completed. Although it is not complete, it is intended to provide a device and method for configuring an MP4 file that supports the recovery and playback of the video or sound stored in the meantime, and to recover the MP4 file.

상술한 목적을 달성하기 위한 본 발명은, 비디오/오디오 데이터(미디어 데이터)를 ISO/IEC 14496-12 규격에 따른 MP4 파일 포맷으로 변환하여 저장하는 MP4 파일 구성 장치로서: 카메라 또는 마이크에 의해 생성된 미디어 데이터를 획득하는 미디어 획득부; 상기 미디어 데이터를 소정의 샘플 단위로 분할하고 각 샘플마다 적어도 상기 샘플의 타임 스탬프 및 사이즈를 나타내는 부가 정보를 추가하여 프레임으로서 mdat box에 기록하고, 상기 미디어 데이터를 MP4 파일 포맷으로 구성하는 데에 필요한 메타 데이터를 생성하여 메모리에 기록하고, 또한 상기 메타 데이터 중 적어도 일부를 MP4 파일에 포함되는 특정 box에 기록하고, 상기 미디어 획득부로부터 상기 미디어 데이터의 획득이 종료되면 당시까지 상기 mdat box에 저장된 상기 미디어 데이터에 대한 최종 메타 데이터로 상기 moov box를 구성하여 상기 MP4 파일에 기록하는 MP4 파일 구성부; 및 상기 MP4 파일 구성부에서 기록하는 복수의 box를 하나의 MP4 파일로서 실시간으로 저장하는 파일 저장부를 포함하는 MP4 파일 구성 장치를 제공한다. The present invention for achieving the above object, MP4 file configuration device for converting and storing video / audio data (media data) to the MP4 file format according to the ISO / IEC 14496-12 standard: generated by a camera or microphone A media obtaining unit obtaining media data; Necessary for dividing the media data into predetermined sample units, adding additional information indicating at least a time stamp and a size of the sample to each sample, recording the data in a mdat box as a frame, and organizing the media data into an MP4 file format. Generate and record the metadata in a memory; and record at least a part of the metadata in a specific box included in an MP4 file, and store the metadata in the mdat box until the media data is obtained from the media acquisition unit. An MP4 file constructing unit configured to form the moov box as final metadata for media data and to record the MP4 file; And a file storage unit for storing a plurality of boxes recorded by the MP4 file configuration unit in real time as one MP4 file.

또한, 상기 메타 데이터는, 적어도, 상기 미디어 데이터의 트랙별 형식(비디오 데이터의 경우에는 적어도 비디오 코덱 및 영상 해상도를 포함하고, 오디오 데이터의 경우에는 적어도 오디오 코덱, 오디오 채널 수, 샘플링 레이트 및 샘플링 비트 수 중 적어도 하나를 포함), 미디어 데이터의 각 프레임별 상기 부가 정보(스트림 ID, 프레임 타입(I-frame 또는 P-frame), 시작 위치 오프셋, 타임 스탬프, 사이즈 중 적어도 하나를 포함), 상기 미디어 데이터의 트랙별 전체 재생 시간(duration)을 포함한다.In addition, the metadata includes at least a track-specific format of the media data (at least in the case of video data, a video codec and an image resolution, and in the case of audio data, at least an audio codec, an audio channel number, a sampling rate, and a sampling bit. At least one of a number), the additional information for each frame of the media data (including at least one of a stream ID, a frame type (I-frame or P-frame), a start position offset, a time stamp, and a size), and the media The total duration of each track of data is included.

또한, 상기 부가 정보는, 해당 프레임의 스트림 ID 또는 프레임 타입을 더 포함한다. The additional information may further include a stream ID or frame type of the corresponding frame.

또한, 상기 특정 box는, free box, skip box, udta box 또는 MP4 파일의 파싱(parsing)시에 무시될 수 있는 box 중 적어도 하나인 것을 특징으로 한다.The specific box may be at least one of a free box, a skip box, a udta box, or a box that can be ignored when parsing an MP4 file.

또한, 상기 특정 box는, 구성되는 MP4 파일에서 상기 mdat box보다 앞에 추가된다.The specific box is added before the mdat box in the MP4 file to be configured.

또한, 본 발명은, ISO/IEC 14496-12 규격에 따라 생성되는 도중에 중단된 MP4 파일로부터 비디오/오디오 데이터(미디어 데이터)를 복구하기 위한 MP4 파일 복구 장치로서: 미디어 데이터가 소정의 샘플 단위로 분할되고 각 샘플마다 적어도 상기 샘플의 타임 스탬프 및 사이즈를 나타내는 부가 정보가 추가되어 프레임으로서 mdat box에 기록되었고, 적어도 상기 미디어 데이터를 MP4 파일 포맷으로 구성하는 데에 필요한 메타 데이터의 적어도 일부가 MP4 파일에 포함되는 특정 box에 기록되었으나, 상기 mdat box가 불완전하거나 moov box가 없거나 불완전한 상태인 손상된 MP4 파일을 획득하는 MP4 파일 획득부; 및 상기 손상된 MP4 파일에서 상기 프레임마다 기록된 상기 부가 정보를 이용하여 상기 mdat box의 마지막 유효 프레임을 식별하고, 상기 특정 box에 저장된 상기 정보와 식별된 상기 마지막 유효 프레임의 타임 스탬프 및 사이즈를 이용하여 상기 미디어 데이터의 총 재생 시간을 계산하고, 상기 부가 정보와 상기 계산된 총 재생 시간을 이용하여 상기 마지막 유효 프레임까지의 메타 데이터를 생성하고, 상기 생성된 메타 데이터로 상기 moov box를 재구성하여 상기 손상된 MP4 파일에 추가함으로써 상기 손상된 MP4 파일을 정상 파일로 마감(close)하는 파일 복구부를 포함하는 MP4 파일 복구 장치를 제공한다.In addition, the present invention provides an MP4 file recovery apparatus for recovering video / audio data (media data) from an interrupted MP4 file generated in accordance with the ISO / IEC 14496-12 standard, wherein: the media data is divided into predetermined sample units. And additional information indicating at least a time stamp and a size of the sample is added to each sample and recorded in the mdat box as a frame, and at least a part of the metadata required to configure the media data in the MP4 file format is stored in the MP4 file. An MP4 file obtaining unit which obtains a damaged MP4 file recorded in a specific box that is included, but the mdat box is incomplete or there is no moov box or is incomplete; And identifying the last valid frame of the mdat box using the additional information recorded for each frame in the corrupted MP4 file, and using the information stored in the specific box and the time stamp and size of the identified last valid frame. Compute the total playback time of the media data, generate metadata up to the last valid frame using the additional information and the calculated total playback time, and reconstruct the moov box with the generated metadata It provides an MP4 file recovery apparatus including a file recovery unit for closing the damaged MP4 file to a normal file by adding to the MP4 file.

또한, 상기 특정 box는, free box, skip box, udta box, 또는 MP4 파일의 파싱시에 무시될 수 있는 box 중 적어도 하나이며, MP4 파일에서 상기 mdat box보다 앞에 위치한다.The specific box is at least one of a free box, a skip box, a udta box, or a box that can be ignored when parsing an MP4 file, and is located before the mdat box in the MP4 file.

또한, 상기 마지막 유효 프레임은, 상기 부가 정보가 완전하게 기록된 마지막 프레임이고, 상기 총 재생 시간은, 상기 마지막 유효 프레임의 타임 스탬프와 최초 프레임의 타임 스탬프의 시간차를 이용하여 결정된다.The last valid frame is the last frame in which the additional information is completely recorded, and the total reproduction time is determined using the time difference between the time stamp of the last valid frame and the time stamp of the first frame.

또한, 본 발명은, 비디오/오디오 데이터(미디어 데이터)를 ISO/IEC 14496-12 규격에 따른 MP4 파일 포맷으로 변환하여 저장하는 영상 저장 방법으로서: 카메라 또는 마이크에 의해 생성된 미디어 데이터를 획득하는 단계; 상기 미디어 데이터를 소정의 샘플 단위로 분할하고 각 샘플마다 적어도 상기 샘플의 타임 스탬프 및 사이즈를 나타내는 부가 정보를 추가하여 프레임으로서 mdat box에 기록하는 단계; 상기 미디어 데이터를 MP4 파일 포맷으로 구성하는 데에 필요한 메타 데이터를 생성하여 메모리에 기록하고, 또한 상기 메타 데이터 중 적어도 일부를 MP4 파일에 포함되는 특정 box에 기록하는 단계; 및 상기 미디어 획득부로부터 상기 미디어 데이터의 획득이 종료되면 당시까지 상기 mdat box에 저장된 상기 미디어 데이터에 대한 최종 메타 데이터로 상기 moov box를 구성하여 상기 MP4 파일에 기록하는 단계를 포함하는 MP4 파일 구성 방법을 제공한다.The present invention also provides a video storage method for converting and storing video / audio data (media data) into an MP4 file format according to the ISO / IEC 14496-12 standard, the method comprising: obtaining media data generated by a camera or a microphone; ; Dividing the media data into predetermined sample units and adding additional information indicating at least a time stamp and a size of the sample for each sample to record in a mdat box as a frame; Generating and recording meta data necessary for organizing the media data into an MP4 file format in a memory, and recording at least a part of the meta data into a specific box included in the MP4 file; And when the acquisition of the media data from the media acquiring unit is completed, constructing the moov box with the final metadata for the media data stored in the mdat box and recording it in the MP4 file. To provide.

또한, 상기 메타 데이터는, 적어도, 상기 미디어 데이터의 트랙별 형식(비디오 데이터의 경우에는 적어도 비디오 코덱 및 영상 해상도를 포함하고, 오디오 데이터의 경우에는 적어도 오디오 코덱, 오디오 채널 수, 샘플링 레이트 및 샘플링 비트 수 중 적어도 하나를 포함), 미디어 데이터의 각 프레임별 상기 부가 정보(스트림 ID, 프레임 타입, 시작 위치 오프셋, 타임 스탬프, 사이즈 중 적어도 하나를 포함), 상기 미디어 데이터의 트랙별 전체 재생 시간(duration)을 포함하고, 상기 특정 box는, 구성되는 MP4 파일에서 상기 mdat box보다 앞에 추가되는 free box, skip box, udta box 또는 MP4 파일의 파싱시에 무시될 수 있는 box 중 적어도 하나인 것을 특징으로 한다.In addition, the metadata includes at least a track-specific format of the media data (at least in the case of video data, a video codec and an image resolution, and in the case of audio data, at least an audio codec, an audio channel number, a sampling rate, and a sampling bit. At least one of a number), the additional information (including at least one of a stream ID, a frame type, a start position offset, a time stamp, and a size) for each frame of media data, and a total duration of each track of the media data. Wherein the specific box is at least one of a free box, a skip box, a udta box, or a box that can be ignored when parsing an MP4 file added before the mdat box in the MP4 file. .

또한, 본 발명은, ISO/IEC 14496-12 규격에 따라 생성되는 도중에 중단된 MP4 파일로부터 비디오/오디오 데이터(미디어 데이터)를 복구하기 위한 MP4 파일 복구 방법으로서: 미디어 데이터가 소정의 샘플 단위로 분할되고 각 샘플마다 적어도 상기 샘플의 타임 스탬프 및 사이즈를 나타내는 부가 정보가 추가되어 프레임으로서 mdat box에 기록되었고, 적어도 상기 미디어 데이터를 MP4 파일 포맷으로 구성하는 데에 필요한 메타 데이터의 적어도 일부가 MP4 파일에 포함되는 특정 box에 기록되었으나, 상기 mdat box가 불완전하거나 moov box가 없거나 불완전한 상태인 손상된 MP4 파일을 획득하는 단계; 상기 손상된 MP4 파일에서 상기 프레임마다 기록된 상기 부가 정보를 이용하여 상기 mdat box의 마지막 유효 프레임을 식별하고, 상기 특정 box에 저장된 상기 정보와 식별된 상기 마지막 유효 프레임의 타임 스탬프 및 사이즈를 이용하여 상기 미디어 데이터의 총 재생 시간을 계산하고, 상기 부가 정보와 상기 계산된 총 재생 시간을 이용하여 상기 마지막 유효 프레임까지의 메타 데이터를 생성하는 단계; 및 상기 생성된 메타 데이터로 상기 moov box를 재구성하여 상기 손상된 MP4 파일에 추가함으로써 상기 손상된 MP4 파일을 정상 파일로 마감하는 단계를 포함하는 MP4 파일 복구 방법을 제공한다.In addition, the present invention provides an MP4 file recovery method for recovering video / audio data (media data) from an interrupted MP4 file generated in accordance with the ISO / IEC 14496-12 standard, wherein the media data is divided into predetermined sample units. And additional information indicating at least a time stamp and a size of the sample is added to each sample and recorded in the mdat box as a frame, and at least a part of the metadata required to configure the media data in the MP4 file format is stored in the MP4 file. Acquiring a damaged MP4 file recorded in a specific box to be included, wherein the mdat box is incomplete, there is no moov box, or is incomplete; Identifying the last valid frame of the mdat box using the additional information recorded for each frame in the corrupted MP4 file, and using the information stored in the specific box and the time stamp and size of the identified last valid frame. Calculating a total play time of media data and generating metadata up to the last valid frame using the additional information and the calculated total play time; And reconstructing the moov box with the generated metadata and adding the damaged MP4 file to the damaged MP4 file, thereby closing the damaged MP4 file as a normal file.

또한, 상기 메타 데이터는, 적어도, 상기 미디어 데이터의 트랙별 형식(비디오 데이터의 경우에는 적어도 비디오 코덱 및 영상 해상도를 포함하고, 오디오 데이터의 경우에는 적어도 오디오 코덱, 오디오 채널 수, 샘플링 레이트 및 샘플링 비트 수를 포함), 미디어 데이터의 각 프레임별 상기 부가 정보(스트림 ID, 프레임 타입, 시작 위치 오프셋, 타임 스탬프, 사이즈), 상기 미디어 데이터의 트랙별 전체 재생 시간(duration)을 포함하고, 상기 특정 box는, 구성되는 MP4 파일에서 상기 mdat box보다 앞에 추가되는 free box, skip box, udta box 중 적어도 하나이고, 상기 마지막 유효 프레임은, 상기 부가 정보가 완전하게 기록된 마지막 프레임이고, 상기 재생 시간은, 상기 마지막 유효 프레임의 타임 스탬프와 최초 프레임의 타임 스탬프의 시간차를 이용하여 결정되는 것을 특징으로 한다.In addition, the metadata includes at least a track-specific format of the media data (at least in the case of video data, a video codec and an image resolution, and in the case of audio data, at least an audio codec, an audio channel number, a sampling rate, and a sampling bit. The additional information (stream ID, frame type, start position offset, time stamp, size) for each frame of media data, the total duration of each track of the media data, and the specific box. Is at least one of a free box, skip box, and udta box added before the mdat box in the MP4 file, wherein the last valid frame is the last frame in which the additional information is completely recorded, and the reproduction time is Determined using the time difference between the time stamp of the last valid frame and the time stamp of the first frame The features.

상술한 바와 같은 구성으로 이루어지는 본 발명에 따른 MP4 파일 구성 장치에 의하면, 영상을 촬영하거나 음향을 녹음하여 실시간으로 MP4 파일로서 저장하는 중에 어떤 장치가 중단되어 파일에 포함되어야할 moov box의 저장이 완료되지 않았거나 moov box가 완전하지 않아서 MP4 파일이 정상적으로 완료(close)되지 않았더라도, 그동안 저장된 데이터만을 이용하여 당시까지 저장된 영상 또는 음향을 복구하여 재생할 수 있게 된다. According to the MP4 file construction apparatus according to the present invention having the above-described configuration, the storage of the moov box to be included in the file is completed by stopping any device while recording the image or recording the sound and storing it as an MP4 file in real time. Even if the MP4 file is not normally closed because the file is not completed or the moov box is not complete, it is possible to restore and play the video or sound saved up to that time by using only the stored data.

또한, 본 발명에 의해 생성된 MP4 파일을 기존의 MP4 파일 플레이어를 이용하여 재생하더라도, 동일하게 재생할 수 있게 된다. Further, even if the MP4 file generated by the present invention is played back using an existing MP4 file player, the same can be played back.

도 1은 MP4 파일의 구성을 개략적으로 보여주는 블록도이다.
도 2는 MP4 파일의 또다른 구성을 개략적으로 보여주는 블록도이다.
도 3은 본 발명의 일 실시예에 따른 MP4 파일 구성 장치 및 MP4 파일 복구 장치의 구성을 나타낸 블록도이다.
도 4는 본 발명에 따른 MP4 파일 구성 장치에 의해 생성된 MP4 파일 중 mdat box에 저장되는 미디어 데이터의 구조를 설명하는 도면이다.
도 5는 손상된 MP4 파일 및 본 발명에 따른 MP4 파일 복구 장치에 의해 복구된 MP4 파일의 구조를 설명하는 도면이다.
도 6은 본 발명에 따른 MP4 파일 구성 장치의 동작을 설명하는 흐름도이다.
도 7은 본 발명에 따른 MP4 파일 복구 장치의 동작을 설명하는 흐름도이다.
1 is a block diagram schematically showing the configuration of an MP4 file.
2 is a block diagram schematically showing another configuration of an MP4 file.
3 is a block diagram illustrating a configuration of an MP4 file construction apparatus and an MP4 file recovery apparatus according to an embodiment of the present invention.
4 is a view for explaining the structure of media data stored in an mdat box among MP4 files generated by the MP4 file construction apparatus according to the present invention.
Fig. 5 is a view for explaining the structure of a damaged MP4 file and an MP4 file recovered by the MP4 file recovery apparatus according to the present invention.
6 is a flowchart illustrating the operation of the apparatus for constructing an MP4 file according to the present invention.
7 is a flowchart illustrating the operation of the MP4 file recovery apparatus according to the present invention.

이하, 본 발명에 따른 ISO/IEC 14496-12 규격에 따른 MP4 파일을 구성하는 장치 및 상기 장치에 의해 생성되는 도중에 중단되어 손상된 MP4 파일을 복구하는 장치, 상기 장치들에 의해 MP4 파일을 구성하는 방법 및 손상된 MP4 파일을 복구하는 방법을 도 3 내지 도 7을 참조하여 설명한다. Hereinafter, a device for constructing an MP4 file according to the ISO / IEC 14496-12 standard according to the present invention and a device for recovering a damaged MP4 file interrupted while being generated by the device, a method for constructing an MP4 file by the devices And a method of repairing a damaged MP4 file will be described with reference to FIGS. 3 to 7.

MP4 파일에 저장되는 미디어 데이터는 카메라로 촬영된 영상에 대한 비디오 데이터와 마이크로 녹음되는 음향에 대한 오디오 데이터를 포함할 수 있다. 또한, 각 MP4 파일은 적어도 하나의 비디오 데이터 또는 오디오 데이터를 포함할 수 있으나, 여기에서는 설명의 편의를 위하여, 이 중 어느 하나만을 미디어 데이터로서 기록하는 것으로 하여 설명한다. The media data stored in the MP4 file may include video data of an image photographed by a camera and audio data of a sound recorded by a microphone. In addition, each MP4 file may include at least one video data or audio data. However, for convenience of description, only one of them is recorded as media data.

또한, 개시된 각 box의 종류 및 이들의 구현 방식, 다양한 용어들에 대해서는 "ISO/IEC 14496-12 ISO base media file format"에 정의된 사항들을 참조하여 이해할 수 있다.
In addition, the types of respective boxes, their implementation manners, and various terms may be understood with reference to the items defined in the ISO / IEC 14496-12 ISO base media file format.

도 3은 본 발명의 일 실시예에 따른, MP4 파일 구성 장치 및 MP4 파일 복구 장치의 구성을 나타낸 블록도이다. 도 3을 참조하면, MP4 파일 구성 장치는, 미디어 획득부와, MP4 파일 구성부와, 파일 저장부를 포함하여 이루어진다. 또한, MP4 파일 복구 장치는 MP4 파일 획득부와 파일 복구부를 포함하여 이루어진다. 3 is a block diagram illustrating a configuration of an MP4 file construction apparatus and an MP4 file recovery apparatus according to an embodiment of the present invention. Referring to FIG. 3, the MP4 file constructing apparatus includes a media obtaining unit, an MP4 file constructing unit, and a file storing unit. In addition, the MP4 file recovery apparatus includes an MP4 file acquisition unit and a file recovery unit.

먼저, MP4 파일 구성 장치의 미디어 획득부는, 카메라에서 촬영한 영상 및/또는 마이크를 통해 입력받은 음향을 각각 디지털 데이터 스트림으로 변환하여 생성한 비디오 데이터 및/또는 오디오 데이터를 입력받는다. 이러한 비디오/오디오 데이터는 카메라 및/또는 마이크로부터 직접 입력받을 수도 있으며, 네트워크 통신 또는 외부 장치와의 연결로부터 전송받거나 MP4 파일 포맷 이외의 다른 포맷의 파일로부터 추출하는 방식으로 획득할 수도 있다.First, the media acquisition unit of the MP4 file constituting device receives video data and / or audio data generated by converting an image captured by a camera and / or a sound input through a microphone into a digital data stream. Such video / audio data may be directly input from a camera and / or a microphone, or may be obtained by being transmitted from a network communication or a connection with an external device or by extracting from a file having a format other than the MP4 file format.

MP4 파일 구성부는, 미디어 획득부에서 획득한 미디어 데이터를 임의의 단위(샘플)로 분할하고, 각 분할된 미디어 데이터의 샘플에 대한 타임 스탬프 및 사이즈를 나타내는 부가 정보를 생성한다. 그리고, 생성된 부가 정보와 샘플을 결합하여 프레임을 구성한다. 이렇게 샘플 단위로 분할되어 부가 정보가 추가된 미디어 데이터의 프레임은, 생성된 순서에 따라 mdat box에 순차적으로 기록된다. 부가 정보에는, 스트림 ID, 프레임 타입(I-frame 또는 P-frame), 분할된 미디어 데이터의 사이즈 등이 포함될 수 있다. The MP4 file construction unit divides the media data obtained by the media acquisition unit into arbitrary units (samples), and generates additional information indicating a time stamp and a size for a sample of each divided media data. Then, the generated additional information and the sample are combined to form a frame. The frames of media data divided into sample units and added additional information are sequentially recorded in the mdat box according to the generated order. The additional information may include a stream ID, a frame type (I-frame or P-frame), size of divided media data, and the like.

한편, MP4 파일 구성부는, 전형적인 MP4 파일을 구성할 때와 동일하게, 미디어 데이터의 트랙별 형식(비디오 데이터의 경우에는 적어도 비디오 코덱 및 영상 해상도를 포함하고, 오디오 데이터의 경우에는 적어도 오디오 코덱, 오디오 채널 수, 샘플링 레이트 및 샘플링 비트 수를 포함하는 정보), 미디어 데이터의 각 프레임별 부가 정보(스트림 ID, 프레임 타입(I-frame 또는 P-frame), 시작 위치 오프셋, 타임 스탬프, 사이즈), 미디어 데이터의 트랙별 전체 재생 시간(duration)을 포함하는 메타 데이터를 생성하고, 이를 메모리에 임시 저장한다. On the other hand, the MP4 file constitution unit includes at least a video codec and a video resolution in the case of a track data format (in the case of video data, and at least an audio codec and audio in the case of video data, as in the case of configuring a typical MP4 file). Information including the number of channels, the sampling rate and the number of sampling bits), additional information for each frame of the media data (stream ID, frame type (I-frame or P-frame), start position offset, time stamp, size), media Meta data including the total duration of each track of data is generated and temporarily stored in the memory.

MP4 파일 구성부는, 상기 메타 데이터를 메모리뿐만 아니라 MP4 파일 포맷에서 규정하는 특정의 box에도 동시에 기록하여 둔다. 이러한 특정의 box는 free box, skip box, udta box 중 적어도 하나일 수 있다. 이러한 box들은 일반적인 MP4 파일 플레이어에서는 MP4 파일 파싱(parsing)시에 무시되는 box들 중에서 선택된다. 상술한 box 이외에도, 일반적인 상황에서는 무시되며, 사용자에 의해 임의의 내용을 기록할 수 있는 box가 정의된다면, 메타 데이터를 그 box에 기록하여 두도록 구성하는 것도 가능하다. The MP4 file constitution unit simultaneously records the meta data not only in the memory but also in a specific box defined by the MP4 file format. This particular box may be at least one of a free box, a skip box, and a udta box. These boxes are selected from the boxes that are ignored when parsing an MP4 file in a typical MP4 file player. In addition to the above-described box, if a box that can be ignored in a general situation and can record arbitrary contents is defined by the user, the metadata may be recorded in the box.

한편, 메타 데이터가 기록된 특정의 box는, MP4 파일을 구성할 때, 미디어 데이터가 기록되는 mdat box에 앞서 배치되는 것이 바람직하다. 특정의 box는 이하에서 free box인 것으로 하여 설명한다. On the other hand, it is preferable that the specific box in which the meta data is recorded is arranged before the mdat box in which the media data is recorded when constituting the MP4 file. A specific box is described below as a free box.

이렇게 부가 정보를 추가하여 프레임을 구성하고, 메타 데이터를 생성하여 메모리에 기록하는 상태에서, 녹화 또는 녹음이 임의의 저장 시간 또는 지정된 저장 용량에 도달하여 기록하는 MP4 파일을 종료하고자 하는 경우, 지금까지 메모리에 저장된 메타 데이터를 MP4 파일의 moov box에 기록한다. moov box가 정상적으로 추가됨으로써 MP4 파일은 정상적으로 마감(close)된다. In this way, when additional frames are added to form a frame, metadata is generated and recorded in the memory, and the recording or recording reaches an arbitrary storage time or a specified storage capacity, the MP4 file to be recorded is terminated until now. Record the metadata stored in memory in the moov box of the MP4 file. The MP4 file is closed normally by adding the moov box normally.

파일 저장부는, MP4 파일 구성부에서 생성하는 미디어 데이터를 실시간으로 저장할 수 있는 저장 공간으로서 비휘발성 저장 공간인 것이 바람직하다. 더욱, 파일 저장부는 moov box에 기록될 메타 데이터를 기록하여두는 메모리를 더 포함하는 것으로 한다.
The file storage unit is a non-volatile storage space as a storage space capable of storing in real time the media data generated by the MP4 file configuration unit. Further, the file storage section further includes a memory for recording meta data to be recorded in the moov box.

이와 같이, MP4 파일 구성 장치에 의해 미디어 데이터가 저장된 mdat box의 구성을 도 4를 참조하여 설명한다. 본 발명에서는, 미디어 데이터를 샘플 단위로 구분하고(M1, M2, M3, ...), 각각의 구분된 샘플마다 해당 샘플의 특성을 나타내는 부가 정보(H1, H2, H3, ...)를 부가하여 프레임을 구성하고(F1, F2, F3, ...) mdat box에 순차적으로 기록한다.In this way, the configuration of the mdat box in which the media data is stored by the MP4 file construction apparatus will be described with reference to FIG. In the present invention, the media data is divided into sample units (M1, M2, M3, ...), and for each divided sample, additional information (H1, H2, H3, ...) indicating the characteristics of the sample is provided. In addition, a frame is constructed (F1, F2, F3, ...) and sequentially recorded in the mdat box.

여기서, 부가 정보는 바로 다음에 이어지는 미디어 데이터의 샘플에 대한 특성을 표시하기 위한 것으로서, 스트림 ID, 프레임 타입(I-frame, P-frame), 타임 스탬프, 사이즈, 기타 정보를 포함할 수 있다. 여기에서, 부가 정보는, 적어도 타임 스탬프와 사이즈를 포함해야 한다. In this case, the additional information is for indicating a characteristic of a sample of media data immediately following and may include a stream ID, a frame type (I-frame, P-frame), a time stamp, a size, and other information. Here, the additional information should include at least a time stamp and a size.

스트림 ID는, 미디어 데이터에 대한 ID로서, 비디오 데이터의 스트림 또는 오디오 데이터의 스트림으로 구분될 수 있다. 그리고 예를 들여, 비디오 데이터의 스트림이 2개 이상 존재한다면, 각 스트림에 대하여 다른 ID를 부여하게 된다. The stream ID is an ID for the media data and may be divided into a stream of video data or a stream of audio data. For example, if two or more streams of video data exist, different IDs are assigned to each stream.

프레임 타입은, 미디어 데이터가 비디오 데이터인 경우에만 사용되는 것으로서, I-frame인지 P-frame인지 구분하기 위한 것이다. The frame type is used only when the media data is video data, and is used to distinguish whether an I-frame or a P-frame.

타임 스탬프는, 각 프레임에 기록된 미디어 데이터의 재생 시간을 표시하기 위한 정보이다. 타임 스탬프는, 시간의 단위(예를 들면, ms)로 표시될 수도 있으나, 일정한 단위가 없는 소정의 타임 스케일로 표현되는 것이 일반적이다. 이때, 타임 스케일과 실제 시간과의 변환 관계는 메타 데이터에 기록될 수 있다. The time stamp is information for indicating the reproduction time of the media data recorded in each frame. The time stamp may be expressed in units of time (for example, ms), but is generally expressed in a predetermined time scale without a certain unit. In this case, the conversion relationship between the time scale and the actual time may be recorded in the metadata.

사이즈는, 미디어 데이터가 분할되어 기록된 각 샘플의 사이즈를 나타낸다. 주로 바이트 단위로 기록될 수 있다. The size represents the size of each sample in which the media data is divided and recorded. It can be written primarily in bytes.

기타 정보는, 복구 목적 또는 다른 목적에 의한 다른 데이터를 기록할 수 있도록 만들어 놓은 공간이다. The other information is a space made for recording other data for recovery purposes or other purposes.

이와 같이, 본 발명에 따른 mdat box의 구조에 의하면, 미디어 데이터의 프레임마다 추가되어 있는 부가 정보가 적어도 프레임의 시간적인 위치를 표시하는 정보(타임 스탬프)와 프레임의 크기(즉, 프레임에 분할되어 기록된 미디어 데이터의 사이즈를 표시하는 정보)를 포함하는 것만으로도, MP4 파일을 복구할 수 있게 된다(MP4 파일 포맷을 완성하여 파일을 복구하는 데에 필요한 다양한 정보들(메타 데이터)의 적어도 일부가 free box에 별도로 이미 저장되어 있기 때문인데, 이를 이용한 복구 방법은 후술한다). As described above, according to the structure of the mdat box according to the present invention, additional information added for each frame of media data is divided into information (time stamp) indicating at least the temporal position of the frame and the size of the frame (that is, divided into frames). Only by including the information indicating the size of the recorded media data, it is possible to recover the MP4 file (at least a part of the various information (meta data) necessary to recover the file by completing the MP4 file format). Is already stored separately in the free box, a recovery method using the same will be described later).

도 5는 손상된 MP4 파일 및 본 발명에 따른 MP4 파일 복구 장치에 의해 복구된 MP4 파일의 구조를 설명하는 도면이다. 손상된 MP4 파일은, 본 발명에 따른 MP4 파일 구성 장치에 의해 기록되는 도중에 불완전하게 중단된 형태로서, MP4 파일의 시작 부분을 구성하는 ftyp box가 기본적으로 존재하며, 파일의 복구를 위한 free box가 구비되어 있고, 이어서 미디어 데이터의 프레임이 mdat box에 시간순으로 기록되는 중에 중단된 형태이다.Fig. 5 is a view for explaining the structure of a damaged MP4 file and an MP4 file recovered by the MP4 file recovery apparatus according to the present invention. The damaged MP4 file is incompletely interrupted while being recorded by the MP4 file construction device according to the present invention. A ftyp box constituting the beginning of the MP4 file is basically present, and a free box for recovering the file is provided. The media data is then interrupted while the frames of the media data are recorded in chronological order in the mdat box.

이렇게 도중에 중단된 파일은, MP4 파일에 기록된 미디어 데이터에 관련한 정보를 기록하고 파일을 마감하는 moov box가 미처 기록되지 않은 상태이므로, 일반적인 MP4 파일 플레이어에서는 재생될 수 없다. The file interrupted in this way cannot be reproduced in a general MP4 file player because a moov box for recording information related to the media data recorded in the MP4 file and closing the file is not already recorded.

한편, 본 발명의 MP4 파일 복구 장치에 의해 복구된 MP4 파일은, mdat box의 기록이 중단된 시점까지 기록된 미디어 데이터가 최대한 보존되고, 여기까지의 미디어 데이터에 대한 메타 데이터를 포함하는 moov box가 추가된 형태가 된다. 이로써 복구된 MP4 파일은 정상 재생 가능한 MP4 파일로서 인식될 수 있다.
On the other hand, in the MP4 file recovered by the MP4 file recovery apparatus of the present invention, the media data recorded until the time when the recording of the mdat box is stopped is preserved as much as possible, and the moov box including the metadata for the media data up to this point is It is an added form. The MP4 file recovered thereby can be recognized as a normal playable MP4 file.

다시, 도 3으로 돌아가서, MP4 파일 구성 장치에 의해 기록되다가 기록이 중단되어 손상된 MP4 파일을 정상 재생 가능한 MP4 파일로 복구하는, MP4 파일 복구 장치의 구성을 설명한다. 3, the configuration of the MP4 file recovery apparatus for recovering a damaged MP4 file to a normal reproducible MP4 file recorded by the MP4 file construction apparatus and then stopped recording will be described.

MP4 파일 획득부는, MP4 파일 구성 장치의 파일 저장부로부터 또는 다른 데이터베이스 또는 네트워크 스트림을 통해 손상된 MP4 파일을 획득한다. 이 손상된 MP4 파일은 미디어 데이터가 mdat box에 기록되다가 중단된 상태이므로, 마지막 프레임은 기록되다가 불완전한 형태로 중단된 상태일 수 있다. 따라서, 프레임을 구성하는 부가 정보의 일부 또는 미디어 데이터의 일부가 손상된 상태이다.The MP4 file obtaining unit obtains the damaged MP4 file from the file storage unit of the MP4 file constructing device or through another database or network stream. Since the damaged MP4 file is interrupted while the media data is recorded in the mdat box, the last frame may be recorded and stopped in an incomplete form. Therefore, part of the additional information or part of the media data constituting the frame is damaged.

파일 복구부는, 손상된 파일에서 최종으로 기록된 프레임을 확인하고, 최종 프레임에 기록된 부가 정보가 유효한지를 확인한다. 최종 프레임에 부가 정보가 유효화게 기록되었다면, 그 프레임은 유효 프레임으로 간주할 수 있다. The file recovery unit checks the last recorded frame in the damaged file and checks whether the additional information recorded in the final frame is valid. If additional information is validly recorded in the last frame, the frame can be regarded as a valid frame.

유효 프레임은 해당 프레임에 기록된 미디어 데이터의 샘플에 대한 부가 정보로서, 스트림 ID, 프레임 타입(I-frame, P-frame), 타임 스탬프, 사이즈, 기타 정보를 포함하고 있으며, 이 중 적어도 타임 스탬프와 사이즈를 포함하고 있으므로, MP4 파일 내에서의 해당 프레임의 타임 스탬프 및 해당 프레임의 기록된 미디어 데이터의 크기를 계산할 수 있다. 더욱, 이를 이용하여, 손상된 MP4 파일에 기록된 미디어 데이터의 전체 재생 시간, 해당 프레임의 오프셋 등을 계산할 수 있게 된다. A valid frame is additional information about a sample of media data recorded in the frame, and includes a stream ID, a frame type (I-frame, P-frame), a time stamp, a size, and other information, at least one of which is a time stamp. And size, the time stamp of the frame in the MP4 file and the size of the recorded media data of the frame can be calculated. Further, using this, it is possible to calculate the total playing time of the media data recorded in the damaged MP4 file, the offset of the corresponding frame, and the like.

또한, mdat box의 유효한 프레임에 포함된 부가 정보를 확인하고 이를 이용함으로써 mdat box의 크기를 계산할 수도 있다. In addition, the size of the mdat box may be calculated by identifying additional information included in a valid frame of the mdat box and using the additional information.

또한, free box가 MP4 파일의 첫부분에 이미 기록되어 있으므로, free box에 기록된 내용들을 이용하여, moov box를 생성하기 위한 다른 정보들을 획득할 수 있다. In addition, since the free box is already recorded at the beginning of the MP4 file, other information for generating the moov box can be obtained using the contents recorded in the free box.

이로써, 파일 복구부에서, moov box에 반드시 포함되어야 할 정보들을 구성할 수 있게 된다. 즉, stts box, stsz box, stsc box, stco box, stss box 등을 구성할 수 있다. In this way, the file recovery unit can configure information that must be included in the moov box. That is, a stts box, stsz box, stsc box, stco box, stss box, and the like can be configured.

moov box를 구성하기 위한 정보들이 만들어지면, 최종 유효 프레임에 뒤이어 moov box를 추가함으로써 손상된 MP4 파일을 정상적으로 마감할 수 있으며, 이렇게 복구된 MP4 파일은 일반적인 MP4 파일 플레이어에서도 정상적으로 재생 가능하게 된다. Once the information for constructing the moov box is made, the damaged MP4 file can be normally closed by adding a moov box following the last valid frame, and the recovered MP4 file can be played normally in a general MP4 file player.

상술한 바와 같은, MP4 파일 구성 장치와 MP4 파일 복구 장치에 의하면, 미디어 데이터를 MP4 파일 포맷으로 변환하여 기록하는 중에, 어떠한 이유로 기록이 중단된 경우라도, 기록이 불완전하게 종료된(손상된) MP4 파일을 정상적인 MP4 파일로 복구할 수 있게 된다. 특히 MP4 파일 구성 장치는, 예를 들면, 차량용 블랙박스에 탑재될 수 있다. 만일 차량용 블랙박스가 전방을 촬영한 비디오/오디오 데이터를 실시간으로 기록하는 중에 교통 사고 등의 이유로 MP4 파일을 미처 정상적으로 완전히 마감하지 못한 상태에서 기록이 중단되었더라도, 기록이 중단된 MP4 파일을 컴퓨터 등에 탑재된 MP4 파일 복구 장치에서 복구할 수 있게 됨으로써, 사고 당시 기록된 내용을 최대한 복구하는 것이 가능하다.
As described above, according to the MP4 file construction device and the MP4 file recovery device, an MP4 file whose recording is incompletely terminated (corrupted) even if recording is interrupted for any reason while converting and recording the media data into the MP4 file format. Can be restored to normal MP4 file. In particular, the MP4 file organizer can be mounted in, for example, a vehicle black box. If the car black box records the video / audio data shot forward in real time, even if the recording is interrupted because the MP4 file is not completely closed due to a traffic accident or other reasons, the recorded MP4 file is loaded on the computer. By being able to recover from the MP4 file recovery device, it is possible to recover the contents recorded at the time of the accident as much as possible.

도 6은, 본 발명에 따른 MP4 파일 구성 장치의 동작을 설명하는 흐름도로서, MP4 파일 구성 장치가 복구 가능한 MP4 파일을 구성하는 방법을 설명한다. Fig. 6 is a flowchart illustrating the operation of the MP4 file construction apparatus according to the present invention, and explains how the MP4 file construction apparatus configures a recoverable MP4 file.

먼저, 카메라나 마이크를 통해 입력된 영상 또는 음향을 디지털 데이터 형태로 구현한 미디어 데이터를 MP4 파일로 기록/저장하기 위하여 ftyp box를 기록하고(S11), 미디어 데이터에 관련된 메타 데이터를 생성하고, 동시에 파일의 복구를 위해 필요한 정보들을 구성하여 free box에 기록한다(S12). First, a ftyp box is recorded to record / save the media data in the form of digital data of an image or sound input through a camera or a microphone (S11), and generate metadata related to the media data, and simultaneously Information necessary for the recovery of the file is constructed and recorded in the free box (S12).

이어서, 미디어 데이터의 스트림을 입력받으면, 획득된 미디어 데이터를 일정 단위로 구분하여 샘플을 생성하고, 구분된 미디어 데이터의 샘플마다 부가 정보를 생성한다. 생성된 부가 정보와 구분된 미디어 데이터의 샘플을 결합하여 프레임을 구성한다. 프레임은 mdat box 내에 시간순에 따라 순차적으로 기록된다(S14). 한편, 미디어 데이터를 획득하여 기록하는 중에, MP4 파일을 구성하는데 필수적인 메타 데이터를 생성하여 메모리에 임시 저장한다. 임시 저장되는 메타 데이터들은 미디어 데이터의 프레임이 기록되는 동안 계속 갱신될 수 있다. Subsequently, when the stream of media data is received, a sample is generated by dividing the obtained media data by a predetermined unit, and additional information is generated for each sample of the divided media data. A frame is formed by combining the generated additional information and the sample of the separated media data. Frames are sequentially recorded in the mdat box in chronological order (S14). On the other hand, while acquiring and recording the media data, the metadata necessary to construct the MP4 file is generated and temporarily stored in the memory. Meta data that is temporarily stored can be continuously updated while frames of media data are recorded.

이렇게 데이터들이 기록되는 중에, 미디어 데이터의 획득이 최종 종료하면(S15), 메모리에 기록된 메타 데이터를 이용하여 moov box를 생성하고, 생성된 moov box를 기록하여 MP4 파일을 정상적으로 마감(close)한다(S16).
When the data is finally recorded while the data is recorded (S15), a moov box is created using the metadata recorded in the memory, and the generated moov box is recorded to close the MP4 file normally. (S16).

도 7은 본 발명에 따른 MP4 파일 복구 장치의 동작을 설명하는 흐름도이다. 도 7은, MP4 파일 구성 장치가 도 6의 절차에 따라 실시간으로 미디어 데이터를 기록하는 도중에, 파일 기록이 중단되어, mdat box가 불완전하거나 moov box가 불완전하여, MP4 파일이 손상된 경우의 파일 복구 절차이다. 7 is a flowchart illustrating the operation of the MP4 file recovery apparatus according to the present invention. FIG. 7 shows a file recovery procedure when the MP4 file configuration device is damaged during recording of media data in real time according to the procedure of FIG. 6, the file recording is interrupted, and the mdat box is incomplete or the moov box is incomplete. to be.

먼저, MP4 파일 복구 장치가, mdat box가 불완전하거나 moov box가 없거나 불완전하여 손상된 MP4 파일을 획득하면(S21), 획득된 파일에 복구를 위한 정보가 저장된 free box가 존재하는지 확인한 후, 저장된 정보를 획득한다(S22). 또한, mdat box에 기록된 각 프레임에도 부가 정보가 기록되어 있는지 확인한다. First, when the MP4 file recovery apparatus acquires a damaged MP4 file due to an incomplete mdat box, a missing moov box, or an incomplete operation (S21), after checking whether a free box in which the information for recovery is stored exists in the obtained file, the stored information is stored. Acquire (S22). It is also checked whether additional information is recorded in each frame recorded in the mdat box.

이어서, mdat box에 기록된 미디어 데이터의 프레임 중 부가 정보가 완전하게 기록된 프레임을 유효 프레임으로서 식별하고, 식별된 유효 프레임 중 가장 마지막 유효 프레임을 최종 유효 프레임으로서 선택한다. mdat box는 식별된 최종 유효 프레임까지에서 종료하는 것으로 설정된다. 식별된 최종 유효 프레임에 기록된 부가 정보를 획득한다(S23).Next, a frame in which additional information is completely recorded among the frames of the media data recorded in the mdat box is identified as a valid frame, and the last valid frame of the identified valid frames is selected as the last valid frame. The mdat box is set to end up to the last valid frame identified. The additional information recorded in the identified last valid frame is obtained (S23).

식별된 최종 유효 프레임으로부터의 부가 정보와 free box에 저장된 정보를 이용하여, 최종 유효 프레임까지에서 MP4 파일을 마감할 수 있도록 moov box에 기록될 메타 데이터를 생성하고, 생성된 메타 데이터로 moov box를 생성하여 최종 유효 프레임까지로 마감된 mdat box에 이어서 추가하고 MP4 파일을 마감한다(S24).
Using the additional information from the identified last valid frame and the information stored in the free box, generate metadata to be recorded in the moov box so that the MP4 file can be closed until the final valid frame, and the generated metadata is used to create the moov box. Create and add to the mdat box after finishing to the last valid frame and finish the MP4 file (S24).

상술한 바와 같은 구성으로 이루어지는 본 발명에 따른 MP4 파일 구성 장치에 의하면, 영상을 촬영하거나 음향을 녹음하여 실시간으로 MP4 파일로서 저장하는 중에 어떤 장치가 중단되어 파일의 끝부분에 포함되어야 할 moov box의 저장이 완전하게 이루어지지 않았거나 mdat box가 비정상적으로 중단된 경우 등 MP4 파일이 정상적으로 완료되지 않았더라도, 그동안 저장된 데이터만을 이용하여 당시까지 저장된 영상 또는 음향을 복구하여 재생할 수 있게 된다. According to the MP4 file construction device according to the present invention having the configuration as described above, while recording the image or recording the sound in real time to store as an MP4 file, any device is interrupted to be included at the end of the file of the moov box Even if the MP4 file is not completed normally, such as when the recording is not completed completely or when the mdat box is abnormally interrupted, it is possible to restore and play the image or sound saved up to that time by using only the stored data.

또한, 본 발명에 의해 생성된 MP4 파일은, MP4 파일 포맷 표준에 적합하기 때문에, 일반적인 MP4 파일과 동일하게 재생될 수 있게 된다. 즉, 기존의 MP4 파일 플레이어를 이용하는 경우, free box는 무시되고, mdat box에 기록된 미디어 데이터는 표준에 적합한 형태이고, moov box의 구성도 표준에 적합하므로, 프레임마다 기록된 부가 정보의 존재는 인식될 수 없으며, 본 발명에 따라 구성된 MP4 파일은 일반적인 MP4 파일로 인식될 수 있는 것이다. In addition, since the MP4 file generated by the present invention conforms to the MP4 file format standard, the MP4 file can be reproduced in the same way as a general MP4 file. That is, when using an existing MP4 file player, the free box is ignored, and the media data recorded in the mdat box is in a form that conforms to the standard, and the configuration of the moov box also conforms to the standard. It cannot be recognized, and the MP4 file constructed according to the present invention can be recognized as a general MP4 file.

일반적인 MP4 파일 플레이어에서는, 각 프레임에서 미디어 데이터 샘플의 시작 지점을 표시하기 위한 오프셋과 프레임 내에 기록된 샘플의 사이즈를 이용하여 미디어 데이터를 식별한다. In a typical MP4 file player, media data is identified using an offset for indicating the starting point of the media data sample in each frame and the size of the sample recorded in the frame.

MP4 파일이 정상적으로 마감된 경우, moov box에는, 각 프레임에서 부가 정보 부분을 제외한 미디어 데이터 샘플의 시작 지점에 대한 오프셋 및 타임 스탬프, 각 샘플의 사이즈가 기록되어 있으므로, 일반적인 MP4 파일 플레이어에서는 부가 정보의 존재를 인식할 수 없으며, 파일의 정상적인 재생에는 문제가 없다.
When the MP4 file is normally closed, the moov box records the offset and time stamp of the start point of the media data sample except for the additional information portion in each frame, and the size of each sample. The existence cannot be recognized, and there is no problem with normal playback of the file.

이하에는, 참조로서, 본 발명에 따른 기술 내용을 실제 구현하는 데에 참고할 사항들을 기록한다.
In the following, reference is made to the references for the actual implementation of the technical contents according to the present invention by reference.

기본 사항The basics

MP4 파일 포맷은 비디오 및 오디오 등의 데이터를 인코딩을 통하여 압축 후 MP4 파일포맷으로 저장하는 기술로서, ISO/IEC 14496-12 ISO base media file format에 표현되어 있다. The MP4 file format is a technology that compresses data such as video and audio through encoding and stores the data in the MP4 file format, which is expressed in ISO / IEC 14496-12 ISO base media file format.

일반적인 MP4 파일 포맷은 기본적으로 Box 단위로 구분되며, 기본이 되는 Box에는 ftyp box, mdat box, moov box가 있다. 그리고 사용자가 임의로 내용을 정의하여 사용할 수 있는 free box가 존재할 수 있습니다.The general MP4 file format is basically divided into box units, and the basic box includes ftyp box, mdat box, and moov box. In addition, there may be a free box that the user can define and use.

- ftyp box : file type box라고 불리며, 파일의 타입과 호환성을 표시하는 box이다.ftyp box: This is called a file type box and indicates the type and compatibility of the file.

- mdat box : media data box라고 불리고, 실질적으로 video/audio frame data가 포함되는 부분이다.-mdat box: It is called a media data box and it is a part that contains video / audio frame data.

- moov box : movie box라고 불리고, 메타 데이터가 기록되며, 파일의 최상위 수준을 구성한다. 일반적으로 moov box는 파일의 시작 또는 끝 가까이에 존재하게 된다. moov box에는 각 데이터들의 트랙(track)이 저장된다. 트랙에는 데이터의 형식(video의 경우에는 코덱 종류와 해상도 등의 정보, audio의 경우에는 코덱 종류와 채널, 샘플링 레이트(sampling-rate), 샘플링 비트(bit per sample) 등의 정보)을 기록하고, 각 비디오/오디오 프레임(샘플) 데이터에 대한 정보를 기록한다.
moov box: Called movie box, metadata is recorded and constitutes the top level of the file. In general, the moov box is near the beginning or end of the file. A track of each data is stored in the moov box. In the track, data format (information such as codec type and resolution in the case of video, and information such as codec type and channel, sampling rate (sampling rate), and bit per sample in the case of audio) is recorded. Records information about each video / audio frame (sample) data.

개요summary

손상된 MP4 파일에서 moov box는 없거나, 잘못된 정보가 포함되어 있기 때문에 MP4 파일을 복구하기 위해서는 moov box에서 필요한 정보를 파일의 다른 위치에 저장해 놓는 방법을 사용한다.In the damaged MP4 file, the moov box is missing or contains incorrect information. To recover the MP4 file, save the necessary information in the moov box to another location in the file.

moov box에서 media의 특성을 나타내는 정보는 free(skip,udta) box를 사용하여 free box 안에 정의하여 필요한 정보를 넣어둔다. free(skip,udta) box는 범용 플레이어에서 MP4 file parsing시에 무시되는 box이다. free box 외에 범용 플레이어에서 무시가 가능한 box도 사용 가능하다.Information representing the characteristics of the media in the moov box is defined in the free box using the free (skip, udta) box and put the necessary information. The free (skip, udta) box is a box that is ignored when parsing MP4 files in a universal player. In addition to free boxes, boxes that can be ignored by general-purpose players are also available.

mdat box에서 video/audio frame data의 부가 정보는 mdat box안에 video/audio frame data를 넣을 때 같이 기록한다.The additional information of the video / audio frame data in the mdat box is recorded together when the video / audio frame data is put in the mdat box.

free(skip, udta) box는 일반 플레이어에서 parsing시에 무시되는 box 영역이므로, 이 box에 복구에 필요한 정보를 넣어두고, 파일을 복구할 필요성이 있을 때 이 box안에 미리 정의된 방식의 data를 읽어서 복구에 필요한 data로 사용할 수 있다.
Since the free (skip, udta) box is a box area that is ignored when parsing in normal players, put the necessary information for recovery in this box and read the data in a predefined way in this box when you need to recover the file. Can be used as data for recovery.

freefree boxbox 에 포함되는 복구에 필요한 정보Required information for recovery included in

가. end. videovideo datadata 에 대한 정보Information about

- video codec(압축 방식) : H.264, MP4V, H.263 등을 의미한다.-video codec (compression method): means H.264, MP4V, H.263, etc.

- video 해상도 : 영상의 width, height.-video resolution: The width and height of the video.

- video codec에서 필요한 정보 : 필요한 경우에만 추가할 수 있다. 예를 들면, H.264인 경우에는 sequence parameter set, picture parameter set를 표시할 수 있다.
Information needed by video codec: Can only be added if necessary. For example, in the case of H.264, a sequence parameter set and a picture parameter set can be displayed.

나. I. audioaudio datadata 에 대한 정보Information about

- audio codec : AAC, AMR, QCELP, EVRC 등을 의미한다.-audio codec: AAC, AMR, QCELP, EVRC, etc.

- audio channel : 1채널, 2채널 등.-audio channel: 1 channel, 2 channel, etc.

- bit per sample : 음향 주파수를 샘플링하는 비트로서 8bit, 16bit 등을 표시하며, audio data의 특성에 따라서 달라질 수 있다.-bit per sample: A bit for sampling sound frequency. It displays 8bit, 16bit, etc., and it can be changed according to the characteristics of audio data.

- sampling rate : audio를 녹음할 때 사용하는 주파수. 예를 들면, 8000Hz, 16000Hz, 22050Hz, 32000Hz, 44100Hz 등.Sampling rate: The frequency used to record audio. For example, 8000 Hz, 16000 Hz, 22050 Hz, 32000 Hz, 44100 Hz, and the like.

- audio codec에서 필요한 정보 : 필요한 경우에만 추가할 수 있다. 예를 들면, AAC 코덱에서는 Audio specific config를 표시할 수 있다.
Information needed by audio codec: Can only be added if necessary. For example, the AAC codec can display an audio specific config.

mdatmdat boxbox 에 포함되는 복구에 필요한 Required for recovery included in videovideo /Of audioaudio frameframe datadata 의 부가정보Additional information from

- stream ID : 각 stream의 ID, video/audio 등으로 구분된 ID.stream ID: ID of each stream, ID separated by video / audio.

- frame type : video의 경우 I-frame, P-frame을 구분하기 위한 정보로서, audio의 경우에는 무의미하다. -frame type: In case of video, it is information to distinguish I-frame and P-frame. In case of audio, it is meaningless.

- time stamp : 각 frame data의 시간을 표시한다.time stamp: Displays the time of each frame data.

- size : 각 frame data의 길이로서, 여기서는, 프레임 내에 기록된 video/audio 데이터의 크기를 표시할 수 있다. -size: The length of each frame data. Here, the size of the video / audio data recorded in the frame can be indicated.

이렇게 데이터 사이즈를 기록하여 둠으로써, mdat box의 프레임마다 추가적인 부가 정보가 포함되더라도 범용 플레이어에서 문제가 발생하지 않게 된다. 즉, 범용 플레이어에서는 MP4 파일의 free box에 기록된 stsc box와 stco(co64) box를 이용하여 frame(sample)의 offset을 계산하여 frame data를 파일로부터 가져오게 되는데, stsc box와 stco(co64) box에 frame data의 chunk 개수와 offset을 저장해둔다면 문제가 발생하지 않는다.
By recording the data size in this way, even if additional additional information is included in each frame of the mdat box, the problem does not occur in the general-purpose player. That is, in a general-purpose player, frame data is obtained from a file by calculating an offset of a frame (sample) using stsc box and stco (co64) box recorded in a free box of an MP4 file, and stsc box and stco (co64) box are obtained. If the chunk number and offset of the frame data are stored in the file, the problem does not occur.

손상된 Damaged MP4MP4 파일의 복구에 필요한  Necessary for file recovery datadata

- video : codec type, width, height, 각 codec에서 필요한 정보, duration(video track의 길이).video: codec type, width, height, information required for each codec, and duration (the length of the video track).

- audio : codec type, channel 수, sampling-rate, bit-per-sample, 각 codec에서 필요한 정보, duration(audio track의 길이).audio: codec type, number of channels, sampling-rate, bit-per-sample, information required for each codec, duration (length of audio track).

- video/audio frame data의 부가 정보 : stream id(video/audio를 구분하기 위함), frame type(video의 경우 I-frame, P-frame을 구분하기 위함), time stamp(각 frame의 시간을 표시하기 위함), size(각 frame의 길이(또는, 각 프레임에 기록된 video/audio data의 길이)를 계산할 때 사용).
-Additional information of video / audio frame data: stream id (to distinguish video / audio), frame type (to distinguish I-frame and P-frame in video), time stamp (indicate time of each frame) Size (used to calculate the length of each frame (or the length of video / audio data recorded in each frame)).

복구 방법Recovery method

가. 복구가능 플레이어에서 파일이 재생 가능한 파일인지 확인한다.end. Verify that the file is playable in the recoverable player.

나. 재생 불가능한 손상된 파일이면, 파일의 앞부분에(mdat box 이전에) free box가 존재하는지 확인하고, 미리 정의된 형식으로 data가 저장되어 있는지 확인한다.I. If the file is damaged and cannot be played, check to see if a free box is present at the beginning of the file (before the mdat box) and if the data is stored in a predefined format.

다. free box에 저장된 data로 moov box의 생성에 필요한 정보 중 일부를 생성한다.All. Generates some of the information needed to create the moov box from the data stored in the free box.

라. mdat box를 검사하여 유효한 frame data의 끝을 결정한다. 유효한 frame data까지의 mdat box의 크기를 계산한다. 즉, mdat box에 포함된 video/audio frame data의 부가 정보(stream id, frame type(I-frame, P-frame), time stamp, size)를 이용하여 유효한 마지막 frame을 찾을 수 있다. 이때 stream id, frame type, time stamp, size가 유효한 값인지를 먼저 확인해야 한다. 유효한 부가 정보의 size를 이용하여 마지막 frame을 찾는다. 손상된 파일의 현재 크기보다 size를 이용하여 얻은 frame data의 끝이 크다면 현재 검사중인 frame data는 부적절한 data로 인식하고 mdat box의 마지막 프레임으로 처리한다.la. Examine the mdat box to determine the end of valid frame data. Compute the size of the mdat box up to the valid frame data. That is, the last valid frame may be found using additional information (stream id, frame type (I-frame, P-frame), time stamp, size) of video / audio frame data included in the mdat box. At this time, the stream id, frame type, time stamp, and size must be checked first. Find the last frame using the size of the valid additional information. If the end of the frame data obtained using size is larger than the current size of the damaged file, the frame data being checked is regarded as inappropriate data and treated as the last frame of the mdat box.

마. Duration(재생 시간) : stream ID로 구분된 각 track의 마지막 frame의 time stamp와 첫 frame의 time stamp와의 차이를 이용하여 각 track의 duration을 계산한다. 각 track의 duration은 각 track 별로 계산된 duration을 사용하고, MP4 file의 duration(mvhd box의 duration)은 각 track의 duration중에서 큰 값을 MP4 file의 duration으로 사용한다.hemp. Duration: The duration of each track is calculated using the difference between the time stamp of the last frame of each track and the time stamp of the first frame, identified by stream ID. The duration of each track uses the duration calculated for each track, and the duration of the MP4 file (the duration of the mvhd box) uses the larger value of the duration of each track as the duration of the MP4 file.

바. stbl box(sample table box) : moov box 안의 각 track 별로 존재하는 box로 mdat box에 이미 저장된 stream id, time stamp, size, frame type을 이용하여 stts box, stsz box, stsc box, stco box, stss box 등을 구성한다. 각 box를 작성하는 방법은 ISO/IEC 14496-12 ISO base media file format을 따른다. free box에 저장된 stream 정보를 이용하여 파일을 정상적으로 마감하기에 필요한 나머지 data를 구성한다. bar. stbl box (sample table box): This box exists for each track in the moov box. It uses std box, stsz box, stsc box, stco box, stss box by using the stream id, time stamp, size, and frame type already stored in the mdat box. And so forth. The method for creating each box follows the ISO / IEC 14496-12 ISO base media file format. Using the stream information stored in the free box, configure the rest of the data needed to close the file normally.

사. 구성된 data를 이용하여 moov box를 기록하고, mdat box의 size를 계산하여 정상적인 파일이 되도록 파일을 close한다.four. Record the moov box using the configured data, calculate the size of the mdat box and close the file so that it is a normal file.

Claims (12)

비디오/오디오 데이터(미디어 데이터)를 ISO/IEC 14496-12 규격에 따른 MP4 파일 포맷으로 변환하여 저장하고 복구하기 위한 MP4 파일 구성 및 복원 시스템으로서:
카메라 또는 마이크에 의해 생성된 미디어 데이터를 획득하는 미디어 획득부;
상기 미디어 데이터를 소정의 샘플 단위로 분할하고 각 샘플마다 적어도 상기 샘플의 타임 스탬프 및 사이즈를 나타내는 부가 정보를 추가하여 프레임으로서 mdat box에 기록하고, 상기 미디어 데이터를 MP4 파일 포맷으로 구성하는 데에 필요한 메타 데이터를 생성하여 메모리에 기록하고, 또한 상기 메타 데이터 중 적어도 일부를 MP4 파일에 포함되는 특정 box에 기록하고, 상기 미디어 획득부로부터 상기 미디어 데이터의 획득이 종료되면 당시까지 상기 mdat box에 저장된 상기 미디어 데이터에 대한 최종 메타 데이터로 moov box를 구성하여 상기 MP4 파일에 기록하는 MP4 파일 구성부;
상기 MP4 파일 구성부에서 기록하는 복수의 box를 하나의 MP4 파일로서 실시간으로 저장하는 파일 저장부;
상기 파일 저장부에 저장된 MP4 파일을 획득하는 MP4 파일 획득부; 및
상기 손상된 MP4 파일에서 상기 프레임마다 기록된 상기 부가 정보를 이용하여 상기 mdat box의 마지막 유효 프레임을 식별하고, 상기 특정 box에 저장된 상기 정보와 식별된 상기 마지막 유효 프레임의 타임 스탬프 및 사이즈를 이용하여 상기 미디어 데이터의 총 재생 시간을 계산하고, 상기 부가 정보와 상기 계산된 총 재생 시간을 이용하여 상기 마지막 유효 프레임까지의 메타 데이터를 생성하고, 상기 생성된 메타 데이터로 상기 moov box를 재구성하여 상기 손상된 MP4 파일에 추가함으로써 상기 손상된 MP4 파일을 정상 파일로 마감(close)하는 파일 복구부를 포함하고,
상기 부가 정보는, 해당 프레임의 스트림 ID 더 포함하고,
상기 마지막 유효 프레임은, 상기 부가 정보가 완전하게 기록된 마지막 프레임이고,
상기 총 재생 시간은, 상기 마지막 유효 프레임의 타임 스탬프와 최초 프레임의 타임 스탬프의 시간차를 이용하여 결정되는 것을 특징으로 하는 MP4 파일 구성 및 복원 시스템.
MP4 file organization and restoration system for converting, saving and restoring video / audio data (media data) to MP4 file format according to ISO / IEC 14496-12:
A media acquisition unit for acquiring media data generated by a camera or a microphone;
Necessary for dividing the media data into predetermined sample units, adding additional information indicating at least a time stamp and a size of the sample to each sample, recording the data in a mdat box as a frame, and organizing the media data into an MP4 file format. Generate and record the metadata in a memory; and record at least a part of the metadata in a specific box included in an MP4 file, and store the metadata in the mdat box until the media data is obtained from the media acquisition unit. An MP4 file constructing unit for constructing a moov box as final meta data for media data and recording it in the MP4 file;
A file storage unit for storing a plurality of boxes recorded by the MP4 file configuration unit in real time as one MP4 file;
An MP4 file obtaining unit obtaining the MP4 file stored in the file storing unit; And
Identifying the last valid frame of the mdat box using the additional information recorded for each frame in the corrupted MP4 file, and using the information stored in the specific box and the time stamp and size of the identified last valid frame. Compute the total play time of the media data, generate metadata up to the last valid frame using the additional information and the calculated total play time, and reconstruct the moov box with the generated metadata to corrupt the damaged MP4. Includes a file recovery unit for closing the damaged MP4 file to a normal file by adding to the file,
The additional information further includes a stream ID of the frame,
The last valid frame is the last frame in which the additional information is completely recorded.
And the total reproduction time is determined using a time difference between the time stamp of the last valid frame and the time stamp of the first frame.
제1항에 있어서,
상기 메타 데이터는, 적어도, 상기 미디어 데이터의 트랙별 형식(비디오 데이터의 경우에는 적어도 비디오 코덱 및 영상 해상도를 포함하고, 오디오 데이터의 경우에는 적어도 오디오 코덱, 오디오 채널 수, 샘플링 레이트 및 샘플링 비트 수 중 적어도 하나를 포함), 미디어 데이터의 각 프레임별 상기 부가 정보(스트림 ID, 프레임 타입(I-frame 또는 P-frame), 시작 위치 오프셋, 타임 스탬프, 사이즈 중 적어도 하나를 포함), 상기 미디어 데이터의 트랙별 전체 재생 시간(duration)을 포함하는 것을 특징으로 하는 MP4 파일 구성 및 복원 시스템.
The method of claim 1,
The metadata includes at least a track-specific format of the media data (at least in the case of video data, a video codec and a video resolution, and in the case of audio data, at least audio codec, audio channel number, sampling rate and sampling bit number). At least one of the additional information (including at least one of a stream ID, a frame type (I-frame or P-frame), a start position offset, a time stamp, and a size) for each frame of the media data; MP4 file organization and restoration system comprising the total duration of each track (duration).
삭제delete 제1항에 있어서,
상기 특정 box는, free box, skip box, udta box 또는 MP4 파일의 파싱(parsing)시에 무시될 수 있는 box 중 적어도 하나인 것을 특징으로 하는 MP4 파일 구성 및 복원 시스템.
The method of claim 1,
And the specific box is at least one of a free box, a skip box, a udta box, or a box that can be ignored when parsing an MP4 file.
제1항에 있어서,
상기 특정 box는, 구성되는 MP4 파일에서 상기 mdat box보다 앞에 추가되는 것을 특징으로 하는 MP4 파일 구성 및 복원 시스템.
The method of claim 1,
And the specific box is added in front of the mdat box in the configured MP4 file.
삭제delete 삭제delete 삭제delete 비디오/오디오 데이터(미디어 데이터)를 ISO/IEC 14496-12 규격에 따른 MP4 파일 포맷으로 변환하여 저장하고 복구하기 위한 영상 저장 방법으로서:
카메라 또는 마이크에 의해 생성된 미디어 데이터를 획득하는 단계;
상기 미디어 데이터를 소정의 샘플 단위로 분할하고 각 샘플마다 적어도 상기 샘플의 타임 스탬프 및 사이즈를 나타내는 부가 정보를 추가하여 프레임으로서 mdat box에 기록하는 단계;
상기 미디어 데이터를 MP4 파일 포맷으로 구성하는 데에 필요한 메타 데이터를 생성하여 메모리에 기록하고, 또한 상기 메타 데이터 중 적어도 일부를 MP4 파일에 포함되는 특정 box에 기록하는 단계;
상기 미디어 획득부로부터 상기 미디어 데이터의 획득이 종료되면 당시까지 상기 mdat box에 저장된 상기 미디어 데이터에 대한 최종 메타 데이터로 moov box를 구성하여 상기 MP4 파일에 기록하는 단계;
상기 MP4 파일에 기록된 손상된 MP4 파일을 획득하는 단계;
상기 손상된 MP4 파일에서 상기 프레임마다 기록된 상기 부가 정보를 이용하여 상기 mdat box의 마지막 유효 프레임을 식별하고, 상기 특정 box에 저장된 상기 정보와 식별된 상기 마지막 유효 프레임의 타임 스탬프 및 사이즈를 이용하여 상기 미디어 데이터의 총 재생 시간을 계산하고, 상기 부가 정보와 상기 계산된 총 재생 시간을 이용하여 상기 마지막 유효 프레임까지의 메타 데이터를 생성하는 단계; 및
상기 생성된 메타 데이터로 상기 moov box를 재구성하여 상기 손상된 MP4 파일에 추가함으로써 상기 손상된 MP4 파일을 정상 파일로 마감하는 단계를 포함하고,
상기 부가 정보는, 해당 프레임의 스트림 ID 더 포함하고,
상기 마지막 유효 프레임은, 상기 부가 정보가 완전하게 기록된 마지막 프레임이고,
상기 재생 시간은, 상기 마지막 유효 프레임의 타임 스탬프와 최초 프레임의 타임 스탬프의 시간차를 이용하여 결정되는 것을 특징으로 하는 MP4 파일 저장 및 복구 방법.
Image storage method for converting video / audio data (media data) to MP4 file format according to ISO / IEC 14496-12, saving and restoring:
Acquiring media data generated by a camera or microphone;
Dividing the media data into predetermined sample units and adding additional information indicating at least a time stamp and a size of the sample for each sample to record in a mdat box as a frame;
Generating and recording meta data necessary for organizing the media data into an MP4 file format in a memory, and recording at least a part of the meta data into a specific box included in the MP4 file;
When the acquisition of the media data from the media acquiring unit is completed, forming a moov box with the final metadata for the media data stored in the mdat box and recording it in the MP4 file;
Acquiring a corrupted MP4 file recorded in the MP4 file;
Identifying the last valid frame of the mdat box using the additional information recorded for each frame in the corrupted MP4 file, and using the information stored in the specific box and the time stamp and size of the identified last valid frame. Calculating a total play time of media data and generating metadata up to the last valid frame using the additional information and the calculated total play time; And
Reconstructing the moov box with the generated metadata and adding the damaged MP4 file to the damaged MP4 file, thereby closing the damaged MP4 file with a normal file.
The additional information further includes a stream ID of the frame,
The last valid frame is the last frame in which the additional information is completely recorded.
And the play time is determined using a time difference between the time stamp of the last valid frame and the time stamp of the first frame.
제9항에 있어서,
상기 메타 데이터는, 적어도, 상기 미디어 데이터의 트랙별 형식(비디오 데이터의 경우에는 적어도 비디오 코덱 및 영상 해상도를 포함하고, 오디오 데이터의 경우에는 적어도 오디오 코덱, 오디오 채널 수, 샘플링 레이트 및 샘플링 비트 수 중 적어도 하나를 포함), 미디어 데이터의 각 프레임별 상기 부가 정보(스트림 ID, 프레임 타입, 시작 위치 오프셋, 타임 스탬프, 사이즈 중 적어도 하나를 포함), 상기 미디어 데이터의 트랙별 전체 재생 시간(duration)을 포함하는 것을 특징으로 하는 MP4 파일 저장 및 복구 방법.
10. The method of claim 9,
The metadata includes at least a track-specific format of the media data (at least in the case of video data, a video codec and a video resolution, and in the case of audio data, at least audio codec, audio channel number, sampling rate and sampling bit number). At least one of the additional information (including at least one of a stream ID, a frame type, a start position offset, a time stamp, and a size) for each frame of media data, and a total duration of each track of the media data. MP4 file storage and recovery method comprising the.
제9항에 있어서,
상기 특정 box는, 구성되는 MP4 파일에서 상기 mdat box보다 앞에 추가되는 free box, skip box, udta box 또는 MP4 파일의 파싱시에 무시될 수 있는 box 중 적어도 하나인 것을 특징으로 하는 MP4 파일 저장 및 복구 방법.
10. The method of claim 9,
The specific box is at least one of a free box, a skip box, a udta box, or a box that can be ignored when parsing an MP4 file, which is added before the mdat box in the configured MP4 file. Way.
삭제delete
KR1020120005039A 2012-01-17 2012-01-17 Mp4 file configuring device and restoring device, mp4 file configuring method and restoring method KR101316579B1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
KR1020120005039A KR101316579B1 (en) 2012-01-17 2012-01-17 Mp4 file configuring device and restoring device, mp4 file configuring method and restoring method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
KR1020120005039A KR101316579B1 (en) 2012-01-17 2012-01-17 Mp4 file configuring device and restoring device, mp4 file configuring method and restoring method

Publications (2)

Publication Number Publication Date
KR20130084345A KR20130084345A (en) 2013-07-25
KR101316579B1 true KR101316579B1 (en) 2013-10-18

Family

ID=48994964

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1020120005039A KR101316579B1 (en) 2012-01-17 2012-01-17 Mp4 file configuring device and restoring device, mp4 file configuring method and restoring method

Country Status (1)

Country Link
KR (1) KR101316579B1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017084310A1 (en) * 2015-11-16 2017-05-26 深圳Tcl数字技术有限公司 Method and device for transmitting mp4 video source
CN106935252A (en) * 2017-02-08 2017-07-07 苏州科达科技股份有限公司 A kind of MP4 document generating methods and device

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6834967B2 (en) * 2015-10-09 2021-02-24 ソニー株式会社 Information processing device and information processing method
CN110139157B (en) * 2019-05-16 2021-03-16 腾讯科技(深圳)有限公司 Accurate positioning playing method, device, equipment and medium
CN113660442B (en) * 2021-08-31 2024-03-19 广州盈可视电子科技有限公司 Video restoration method and device, electronic equipment and readable medium
CN114449316B (en) * 2021-12-02 2023-09-22 北京快乐茄信息技术有限公司 Video processing method and device, electronic equipment and storage medium
CN114374875A (en) * 2021-12-31 2022-04-19 浙江大华技术股份有限公司 MP4 file recording method and device and readable storage medium
CN114666309A (en) * 2022-03-23 2022-06-24 中磊电子(苏州)有限公司 Streaming media processing method, transmission device and receiving device
CN115589480A (en) * 2022-10-09 2023-01-10 深圳市巨龙创视科技有限公司 MOov-based MP4 video restoration method and system

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20050092688A (en) * 2005-08-31 2005-09-22 한국정보통신대학교 산학협력단 Integrated multimedia file format structure, its based multimedia service offer system and method
KR20080070471A (en) * 2007-01-26 2008-07-30 엘지전자 주식회사 Method for constructing of file format and apparatus and method for processing digital broadcast signal with file which has file format
KR20110005484A (en) * 2009-07-10 2011-01-18 주식회사 코아로직 File format generating device, multimedia apparatus comprising the same device, and method for recovering abnormal file using the same device
JP2011061281A (en) * 2009-09-07 2011-03-24 Mitsubishi Electric Corp Media file restoration method, media file preparing method, and media file reproducing method and device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20050092688A (en) * 2005-08-31 2005-09-22 한국정보통신대학교 산학협력단 Integrated multimedia file format structure, its based multimedia service offer system and method
KR20080070471A (en) * 2007-01-26 2008-07-30 엘지전자 주식회사 Method for constructing of file format and apparatus and method for processing digital broadcast signal with file which has file format
KR20110005484A (en) * 2009-07-10 2011-01-18 주식회사 코아로직 File format generating device, multimedia apparatus comprising the same device, and method for recovering abnormal file using the same device
JP2011061281A (en) * 2009-09-07 2011-03-24 Mitsubishi Electric Corp Media file restoration method, media file preparing method, and media file reproducing method and device

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017084310A1 (en) * 2015-11-16 2017-05-26 深圳Tcl数字技术有限公司 Method and device for transmitting mp4 video source
CN106935252A (en) * 2017-02-08 2017-07-07 苏州科达科技股份有限公司 A kind of MP4 document generating methods and device

Also Published As

Publication number Publication date
KR20130084345A (en) 2013-07-25

Similar Documents

Publication Publication Date Title
KR101316579B1 (en) Mp4 file configuring device and restoring device, mp4 file configuring method and restoring method
JP4481889B2 (en) Data recording apparatus and method, program, and recording medium
CN104410807B (en) A kind of multi-channel video synchronized playback method and device
CN101075462B (en) Recording/reproducing/editing apparatus and method
JP3771902B2 (en) System and method for processing MPEG streams for file index insertion
WO2011083626A1 (en) Image processing device, information recording medium, image processing method, and program
WO2011083625A1 (en) Image processing device, information recording medium, image processing medium, and program
CN105103540A (en) File generation method, file generation device and recording medium
CN110740391B (en) Method for repairing MP4 damaged file
KR101711009B1 (en) Apparatus to store image, apparatus to play image, method to store image, method to play image, recording medium, and camera
CN101340538A (en) Recording/reproducing apparatus, recording apparatus, reproducing apparatus, recording method, reproducing method and computer program
WO2016027579A1 (en) Information processing apparatus, information recording medium, information processing method, and program
CN102474588A (en) Transmission controller, reception controller, transmission control method, reception control method and transmission control program
US20050025460A1 (en) Information-processing apparatus, information-processing method, program-recording medium, and program
KR101036768B1 (en) File format generating device, multimedia apparatus comprising the same device, and method for recovering abnormal file using the same device
JP2012170054A (en) Video recording apparatus, video reproduction apparatus, and video recovery apparatus
RU2522040C2 (en) Reproducing method and apparatus, data structure, recording medium, recording apparatus, recording method and programme
KR101051063B1 (en) Video recording and playback device, video recording method, video playback method and video recording playback method
JP6500895B2 (en) INFORMATION PROCESSING APPARATUS, INFORMATION GENERATING APPARATUS, INFORMATION RECORDING MEDIUM, INFORMATION PROCESSING METHOD, AND PROGRAM
CN112929686B (en) Method and device for playing back recorded video in real time on line
JP2012049956A (en) Semiconductor integrated circuit loadable to drive recorder and method of operating the same
KR101995270B1 (en) Method and apparatus for playing video data
JP4383721B2 (en) Demultiplexer
JP2013258655A (en) Information processing unit, moving image generator, control method, program, and restoration method
JP2005348078A (en) Video recorder

Legal Events

Date Code Title Description
A201 Request for examination
E902 Notification of reason for refusal
E701 Decision to grant or registration of patent right
GRNT Written decision to grant
FPAY Annual fee payment

Payment date: 20160923

Year of fee payment: 4

FPAY Annual fee payment

Payment date: 20180612

Year of fee payment: 6

FPAY Annual fee payment

Payment date: 20190731

Year of fee payment: 7