KyleKun / one_second_diary

Minimalist video diary app.
MIT License
300 stars 60 forks source link

Exported Movie on beta v1.5 is Semi-Broken with certain settings #61

Closed r-chong closed 1 year ago

r-chong commented 1 year ago

Hi, I'm using the beta v1.5 prerelease on a Samsung A32 running Android 13.

When I export a movie with certain settings, there is an hour's worth of footage just looping the latest video over and over again. Note: the videos are all there correctly, but the overall time is too much. I only have 171 videos and so the video should not be an hour long.

Exports that are broken for me:

I tested this multiple times by exporting using different settings and watching in different video players (VLC, Samsung)

I think what is happening is that the number of days I have recorded is less than the export I requested For example, I only have 16 days recorded in the last 30 days, so perhaps the export is trying to fill the time. But I'm not fully sure that this is it.

Finally I'd just like to say that I love the new beta features, I've been using this app since December last year and it's amazing. I figured that I would bring up this issue before the Google Play release.

Screenshot_20230115_122147.png

r-chong commented 1 year ago

Here are the lengths of each of my exported files:

"All time" is 1:22:29 with 171 videos. "Last 30 days" is 00:17:27 with 16 videos. "Last 60 days" is also 00:17:27 with 31 videos. "Last 90 days" is 00:20:40 with 33 videos.

I couldn't find a pattern, but maybe this is helpful?

KyleKun commented 1 year ago

Hi @r-chong , thanks so much for reporting this issue before the release.

I have experienced it in previous stages, it happens not because the period selected, but because the videos recorded with v1.1 have different settings from the ones recorded now, so when you create a movie, all the past videos are processed to have the same codecs, frame rate, etc. From my experience, it was fixed completely in latest version.

To identify your problem, can you tell me if you are you using the latest beta available? If so, did you install it directly or did you have beta 1 or beta 2 installed before?

r-chong commented 1 year ago

@KyleKun I'm using the latest prerelease from GitHub, and I did not install the previous beta versions.

KyleKun commented 1 year ago

@KyleKun I'm using the latest prerelease from GitHub, and I did not install the previous beta versions.

Okay, so are you able to test without the video(s) recorded in this version please? You can move them out of the OneSecondDiary folder and generate a movie to see if it works correctly.

r-chong commented 1 year ago

I haven't recorded anything in this version, I've only imported from my photos to fill in some of the gaps in my calendar. I can try removing those?

KyleKun commented 1 year ago

I haven't recorded anything in this version, I've only imported from my photos to fill in some of the gaps in my calendar. I can try removing those?

In this case, please test a custom movie not selecting any of those. And also the inverse if possible, select only the ones added from gallery.

KyleKun commented 1 year ago

@r-chong oh btw, no need to select literally all of them, you can do it only with 4 or 5 selected and that movie problem should be the same.

r-chong commented 1 year ago

I ended up selecting all of them lol.

Both the v1.1 videos and the inverse exported as expected πŸ‘

KyleKun commented 1 year ago

I ended up selecting all of them lol.

Both the v1.1 videos and the inverse exported as expected πŸ‘

lol my comment was delivered too late, sorry for the extra work. But great, this is the best case scenario of the problem, should be easier to debug. I will try to fix it by tonight and will let you know. Thanks once again for all your input 😊

r-chong commented 1 year ago

@KyleKun No need to apologize, you're the one who should be complaining about extra work πŸ˜„

Btw I'd love to contribute to this project.

Is there any way I could be of use, knowing mostly Python and JavaScript?

KyleKun commented 1 year ago

@KyleKun No need to apologize, you're the one who should be complaining about extra work πŸ˜„

Btw I'd love to contribute to this project.

Is there any way I could be of use, knowing mostly Python and JavaScript?

Sure, that would be a great help! I was thinking about making a Python script myself for comparing video properties to make it easier to spot differences.

It would work by inputting a folder path (Windows) where all videos are stored and then it would run the following ffprobe command for all the videos:

ffprobe -v quiet -print_format json -show_format -show_streams $currentVideo

Then it would show how many videos have the same properties (number and order of streams, codecs, resolution, frame rate, these should be enough for now since it would be easier to extend later if needed because the ffprobe brings all the info, so it's basically text parsing).

The output would be something like:

['2023-01-01.mp4', (more files)] -> 1 video stream (1920x1080, 30fps, etc), 1 audio stream (aac, 48000 sample rate, etc), 1 subtitle stream (mov_text, etc)

['2023-01-02.mp4', (more files)] -> 1 video stream (1920x1080, 30fps, etc), no audio stream, no subtitle stream

Results: Analysis returned 2 different video configurations. 30 files share the same properties (3 streams with same codecs, etc) and 5 files share the same config (1 video stream only, with bla bla)

In short, it's a batch file checking and text parsing to show the main differences. Maybe something similar even exists somewhere already, I didn't really search for it, but if not and you really would like to contribute, this shouldn't be hard to create and would help a lot in debugging process 😊

r-chong commented 1 year ago

In short, it's a batch file checking and text parsing to show the main differences. Maybe something similar even exists somewhere already, I didn't really search for it, but if not and you really would like to contribute, this shouldn't be hard to create and would help a lot in debugging process 😊

Sounds doable for me. I'll just have to work a bit with text parsing.

If all goes according to plan, I'll put in a pull request sometime in the coming weeks in between school 🀞

KyleKun commented 1 year ago

Hey @r-chong , i tried quite a bit but unfortunately I couldn't reproduce it on my end. Can you run that command (ffprobe -v quiet -print_format json -show_format -show_streams videoName.mp4) for one of each video type (one for older videos, one for uploaded from gallery) and tell me the output in here please? Just one video from each type will suffice.

r-chong commented 1 year ago

@KyleKun Sorry for the delayed response, here are the outputs:

v1.1

{
    "streams": [
        {
            "index": 0,
            "codec_name": "h264",
            "codec_long_name": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10",
            "profile": "High",
            "codec_type": "video",
            "codec_tag_string": "avc1",
            "codec_tag": "0x31637661",
            "width": 1920,
            "height": 1080,
            "coded_width": 1920,
            "coded_height": 1080,
            "closed_captions": 0,
            "film_grain": 0,
            "has_b_frames": 2,
            "sample_aspect_ratio": "1:1",
            "display_aspect_ratio": "16:9",
            "pix_fmt": "yuv420p",
            "level": 40,
            "color_range": "tv",
            "color_space": "bt470bg",
            "color_transfer": "smpte170m",
            "color_primaries": "bt470bg",
            "chroma_location": "left",
            "field_order": "progressive",
            "refs": 1,
            "is_avc": "true",
            "nal_length_size": "4",
            "id": "0x1",
            "r_frame_rate": "30/1",
            "avg_frame_rate": "30/1",
            "time_base": "1/15360",
            "start_pts": 0,
            "start_time": "0.000000",
            "duration_ts": 15872,
            "duration": "1.033333",
            "bit_rate": "9489731",
            "bits_per_raw_sample": "8",
            "nb_frames": "31",
            "extradata_size": 51,
            "disposition": {
                "default": 1,
                "dub": 0,
                "original": 0,
                "comment": 0,
                "lyrics": 0,
                "karaoke": 0,
                "forced": 0,
                "hearing_impaired": 0,
                "visual_impaired": 0,
                "clean_effects": 0,
                "attached_pic": 0,
                "timed_thumbnails": 0,
                "captions": 0,
                "descriptions": 0,
                "metadata": 0,
                "dependent": 0,
                "still_image": 0
            },
            "tags": {
                "language": "eng",
                "handler_name": "VideoHandle",
                "vendor_id": "[0][0][0][0]",
                "encoder": "Lavc59.37.100 libx264"
            }
        },
        {
            "index": 1,
            "codec_name": "aac",
            "codec_long_name": "AAC (Advanced Audio Coding)",
            "profile": "LC",
            "codec_type": "audio",
            "codec_tag_string": "mp4a",
            "codec_tag": "0x6134706d",
            "sample_fmt": "fltp",
            "sample_rate": "48000",
            "channels": 1,
            "channel_layout": "mono",
            "bits_per_sample": 0,
            "id": "0x2",
            "r_frame_rate": "0/0",
            "avg_frame_rate": "0/0",
            "time_base": "1/48000",
            "start_pts": 0,
            "start_time": "0.000000",
            "duration_ts": 50160,
            "duration": "1.045000",
            "bit_rate": "1628",
            "nb_frames": "50",
            "extradata_size": 5,
            "disposition": {
                "default": 1,
                "dub": 0,
                "original": 0,
                "comment": 0,
                "lyrics": 0,
                "karaoke": 0,
                "forced": 0,
                "hearing_impaired": 0,
                "visual_impaired": 0,
                "clean_effects": 0,
                "attached_pic": 0,
                "timed_thumbnails": 0,
                "captions": 0,
                "descriptions": 0,
                "metadata": 0,
                "dependent": 0,
                "still_image": 0
            },
            "tags": {
                "language": "und",
                "handler_name": "SoundHandler",
                "vendor_id": "[0][0][0][0]"
            }
        },
        {
            "index": 2,
            "codec_name": "mov_text",
            "codec_long_name": "MOV text",
            "codec_type": "subtitle",
            "codec_tag_string": "tx3g",
            "codec_tag": "0x67337874",
            "id": "0x3",
            "r_frame_rate": "0/0",
            "avg_frame_rate": "0/0",
            "time_base": "1/1000000",
            "start_pts": 0,
            "start_time": "0.000000",
            "duration_ts": 0,
            "duration": "0.000000",
            "nb_frames": "2",
            "extradata_size": 48,
            "disposition": {
                "default": 1,
                "dub": 0,
                "original": 0,
                "comment": 0,
                "lyrics": 0,
                "karaoke": 0,
                "forced": 0,
                "hearing_impaired": 0,
                "visual_impaired": 0,
                "clean_effects": 0,
                "attached_pic": 0,
                "timed_thumbnails": 0,
                "captions": 0,
                "descriptions": 0,
                "metadata": 0,
                "dependent": 0,
                "still_image": 0
            },
            "tags": {
                "language": "und",
                "handler_name": "SubtitleHandler"
            }
        }
    ],
    "format": {
        "filename": "2021-12-17.mp4",
        "nb_streams": 3,
        "nb_programs": 0,
        "format_name": "mov,mp4,m4a,3gp,3g2,mj2",
        "format_long_name": "QuickTime / MOV",
        "start_time": "0.000000",
        "duration": "1.045000",
        "size": "1229070",
        "bit_rate": "9409148",
        "probe_score": 100,
        "tags": {
            "major_brand": "isom",
            "minor_version": "512",
            "compatible_brands": "isomiso2avc1mp41",
            "artist": "One Second Diary v1.5",
            "encoder": "Lavf59.27.100"
        }
    }
}
r-chong commented 1 year ago

v1.5

β€Šβ€‹{
    "streams": [
        {
            "index": 0,
            "codec_name": "h264",
            "codec_long_name": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10",
            "profile": "High",
            "codec_type": "video",
            "codec_tag_string": "avc1",
            "codec_tag": "0x31637661",
            "width": 1920,
            "height": 1080,
            "coded_width": 1920,
            "coded_height": 1080,
            "closed_captions": 0,
            "film_grain": 0,
            "has_b_frames": 2,
            "pix_fmt": "yuv420p",
            "level": 40,
            "color_range": "tv",
            "color_space": "bt709",
            "color_transfer": "bt709",
            "color_primaries": "bt709",
            "chroma_location": "left",
            "field_order": "progressive",
            "refs": 1,
            "is_avc": "true",
            "nal_length_size": "4",
            "id": "0x1",
            "r_frame_rate": "30/1",
            "avg_frame_rate": "30/1",
            "time_base": "1/15360",
            "start_pts": 0,
            "start_time": "0.000000",
            "duration_ts": 29184,
            "duration": "1.900000",
            "bit_rate": "436484",
            "bits_per_raw_sample": "8",
            "nb_frames": "57",
            "extradata_size": 50,
            "disposition": {
                "default": 1,
                "dub": 0,
                "original": 0,
                "comment": 0,
                "lyrics": 0,
                "karaoke": 0,
                "forced": 0,
                "hearing_impaired": 0,
                "visual_impaired": 0,
                "clean_effects": 0,
                "attached_pic": 0,
                "timed_thumbnails": 0,
                "captions": 0,
                "descriptions": 0,
                "metadata": 0,
                "dependent": 0,
                "still_image": 0
            },
            "tags": {
                "language": "eng",
                "handler_name": "VideoHandle",
                "vendor_id": "[0][0][0][0]",
                "encoder": "Lavc59.37.100 libx264"
            }
        },
        {
            "index": 1,
            "codec_name": "mov_text",
            "codec_long_name": "MOV text",
            "codec_type": "subtitle",
            "codec_tag_string": "tx3g",
            "codec_tag": "0x67337874",
            "id": "0x2",
            "r_frame_rate": "0/0",
            "avg_frame_rate": "0/0",
            "time_base": "1/1000000",
            "start_pts": 0,
            "start_time": "0.000000",
            "duration_ts": 0,
            "duration": "0.000000",
            "nb_frames": "1",
            "extradata_size": 48,
            "disposition": {
                "default": 1,
                "dub": 0,
                "original": 0,
                "comment": 0,
                "lyrics": 0,
                "karaoke": 0,
                "forced": 0,
                "hearing_impaired": 0,
                "visual_impaired": 0,
                "clean_effects": 0,
                "attached_pic": 0,
                "timed_thumbnails": 0,
                "captions": 0,
                "descriptions": 0,
                "metadata": 0,
                "dependent": 0,
                "still_image": 0
            },
            "tags": {
                "language": "und",
                "handler_name": "SubtitleHandler"
            }
        }
    ],
    "format": {
        "filename": "2023-01-09.mp4",
        "nb_streams": 2,
        "nb_programs": 0,
        "format_name": "mov,mp4,m4a,3gp,3g2,mj2",
        "format_long_name": "QuickTime / MOV",
        "start_time": "0.000000",
        "duration": "1.900000",
        "size": "105768",
        "bit_rate": "445338",
        "probe_score": 100,
        "tags": {
            "major_brand": "isom",
            "minor_version": "512",
            "compatible_brands": "isomiso2avc1mp41",
            "artist": "One Second Diary v1.5",
            "album": "Default",
            "encoder": "Lavf59.27.100"
        }
    }
}β€Š
KyleKun commented 1 year ago

Thanks @r-chong! I can see that the v1.5 does not have an audio stream, which I find pretty uncommon since it was added from the gallery. I am almost sure this is the cause of the issue. Does this video has audio? Was it perhaps a gif?

r-chong commented 1 year ago

It was a mobile screen recording with no audio that I took to record pictures of my new outfit (as importing pictures is not possible)

If that's the item causing an issue, then that's very lucky because I just scanned a random video in my folder!

I'll test if the custom export works without it.

r-chong commented 1 year ago

I'll test if the custom export works without it.

Update: the custom export works as expected after the two videos with no audio were removed.

I guess the fact that the app allows importing from the photo gallery made me think that anything goes πŸ€”

KyleKun commented 1 year ago

I'll test if the custom export works without it.

Update: the custom export works as expected after the two videos with no audio were removed.

I guess the fact that the app allows importing from the photo gallery made me think that anything goes πŸ€”

Great! And you're right, any kind of video should be accepted, but I didn't think of this edge case.

What happens is that the upload from gallery method doesn't check for an existing audio stream (I was assuming all videos would have), then it saves without adding an empty one, becoming different from the past videos.

This causes concat demuxer to fail due the need of all streams being the same. Since I already have the method to check and add an empty audio stream, the fix is easy and will be available later today πŸŽ‰

KyleKun commented 1 year ago

Hey @r-chong, I'll soon publish beta 4 where this problem was fixed 😊 Just to let you know, you'll need to delete and add again these 2 videos that had no audio so it's correctly processed.

r-chong commented 1 year ago

Sounds good! 🀘

KyleKun commented 1 year ago

Hey @r-chong , it took a while but I released the new version, please let me know if you still face this or any other problems. Thanks!

r-chong commented 1 year ago

Hey @KyleKun! Congrats on the new release, I'm downloading the apk as we speak and will do a few more tests to see if the issue is fully removedπŸ‘

PS, apologies if you've been expecting the python script. I'm currently studying for exams so everything else is on hold atm πŸ˜…

KyleKun commented 1 year ago

Hey @KyleKun! Congrats on the new release, I'm downloading the apk as we speak and will do a few more tests to see if the issue is fully removedπŸ‘

PS, apologies if you've been expecting the python script. I'm currently studying for exams so everything else is on hold atm πŸ˜…

Thankss, don't worry about it, good luck on the exams 🀞

r-chong commented 1 year ago

Hey Caio, I just tried out the new version! I have a few observations that you may be interested in.

When I installed the .apk, with the old version still installed (Google Play non beta) the apk returned an error in installation. Uninstalling the Google Play version fixed this. This will probably be solved once you upload to the Play store, but I figured I'd mention it :)

Rendering movies turned out as expected. The first time I pressed create movie was the longest (~10 minutes) but every time after was very fast (under 30 seconds).

UI Nitpick: under "my movies", the created movies are listed from oldest to newest. It may make more sense to users if it was from last modified?

Otherwise looks good πŸ‘

KyleKun commented 1 year ago

Hey Caio, I just tried out the new version! I have a few observations that you may be interested in.

When I installed the .apk, with the old version still installed (Google Play non beta) the apk returned an error in installation. Uninstalling the Google Play version fixed this. This will probably be solved once you upload to the Play store, but I figured I'd mention it :)

Rendering movies turned out as expected. The first time I pressed create movie was the longest (~10 minutes) but every time after was very fast (under 30 seconds).

UI Nitpick: under "my movies", the created movies are listed from oldest to newest. It may make more sense to users if it was from last modified?

Otherwise looks good πŸ‘

Ah yes, it conflicts with playstore signature in fact. Thanks for input, will implement it that way.