harryjackson / ffmpeg_split

Split an ffmpeg file by chapter
Apache License 2.0
55 stars 20 forks source link

ffmpeg has json output #2

Closed phiresky closed 7 years ago

phiresky commented 7 years ago

Just as a note, you could use the integrated json output format of ffmpeg to make the code simpler and more robust. Example:

ffprobe -i fname -print_format json -show_chapters -loglevel error

{
    "chapters": [
        {
            "id": 2072203953,
            "time_base": "1/1000000000",
            "start": 0,
            "start_time": "0.000000",
            "end": 2622000000,
            "end_time": "2.622000",
            "tags": {
                "title": "(Unnamed scene)"
            }
        },
        {
            "id": 675085945,
            "time_base": "1/1000000000",
            "start": 2622000000,
            "start_time": "2.622000",
            "end": 88622000000,
            "end_time": "88.622000",
            "tags": {
                "title": "(Unnamed scene)"
            }
        },
...
harryjackson commented 7 years ago

I've updated the question on stackoverflow with your information. If you have a stackoverflow profile I could add it to the answer.

https://stackoverflow.com/questions/30305953/is-there-an-elegant-way-to-split-a-file-by-chapter-using-ffmpeg/