Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing Video Metadata #351

Closed
Gapplay opened this issue Nov 22, 2018 · 12 comments
Closed

Missing Video Metadata #351

Gapplay opened this issue Nov 22, 2018 · 12 comments
Labels

Comments

@Gapplay
Copy link

Gapplay commented Nov 22, 2018

Hello, the recording videos are missing some metadata like length and frame width/height. VLC can play them normally, but if you try to look for videos details in windows 10, adobe premiere, and other video players. They can't read the metadata and some players cannot read the files.
It could be an encoding problem. I'm comparing a scrycpy video (test.mp4) and adb recording (adb video.mp4)
https://imgur.com/a/IuKqsTn
I hope this helps. Thanks!

image

@rom1v
Copy link
Collaborator

rom1v commented Nov 22, 2018

the recording videos are missing some metadata like length and frame width/height

These metadata are present for both files in your screenshot.

I see nothing important missing.

The only difference is the codec id, which is isom on the left and mp42 on the right, but both should be ok.

@Gapplay
Copy link
Author

Gapplay commented Nov 22, 2018

In the windows explorer, you can see the windows 10 is able to preview the file and read the metadata.
I found a post with a similar mp4 file problem: https://forum.videohelp.com/threads/374899-no-frame-info-(height-width)-shown-in-the-movie-properties-details

@Gapplay
Copy link
Author

Gapplay commented Dec 2, 2018

The video files cannot be opened on:

  • Windows Media Player
  • Movies & TV
  • Quicktimes
  • Adobe Premiere
  • Video Player Android 8.1

It works fine on VLC. I have to transcode the video with Handbrake to make it work.
It seems that some quick-access metadata is missing. If you go to properties on Windows, there are not video details.
Thank you for your work!

scrcypy

@rom1v
Copy link
Collaborator

rom1v commented Dec 2, 2018

Thank you for the details.

I will investigate when I have some time (and currently I don't have access to any of the software that you listed which fail).

For now, could you paste the result of scrcpy -v please?

In particular, I would like to know which #ifdef branch is executed here. If it's the "new version" branch (which uses codecpar), I am interested in the result with the "deprecated" version (which uses codec):

diff --git a/app/src/recorder.c b/app/src/recorder.c
index 2e846e9..b13bb5a 100644
--- a/app/src/recorder.c
+++ b/app/src/recorder.c
@@ -63,25 +63,11 @@ SDL_bool recorder_open(struct recorder *recorder, AVCodec *input_codec) {
         return SDL_FALSE;
     }
 
-// In ffmpeg/doc/APIchanges:
-// 2016-04-11 - 6f69f7a / 9200514 - lavf 57.33.100 / 57.5.0 - avformat.h
-//   Add AVStream.codecpar, deprecate AVStream.codec.
-#if    (LIBAVFORMAT_VERSION_MICRO >= 100 /* FFmpeg */ && \
-        LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(57, 33, 100)) \
-    || (LIBAVFORMAT_VERSION_MICRO < 100 && /* Libav */ \
-        LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(57, 5, 0))
-    ostream->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
-    ostream->codecpar->codec_id = input_codec->id;
-    ostream->codecpar->format = AV_PIX_FMT_YUV420P;
-    ostream->codecpar->width = recorder->declared_frame_size.width;
-    ostream->codecpar->height = recorder->declared_frame_size.height;
-#else
     ostream->codec->codec_type = AVMEDIA_TYPE_VIDEO;
     ostream->codec->codec_id = input_codec->id;
     ostream->codec->pix_fmt = AV_PIX_FMT_YUV420P;
     ostream->codec->width = recorder->declared_frame_size.width;
     ostream->codec->height = recorder->declared_frame_size.height;
-#endif
     ostream->time_base = (AVRational) {1, 1000000}; // timestamps in us
 
     int ret = avio_open(&recorder->ctx->pb, recorder->filename,

@Gapplay
Copy link
Author

Gapplay commented Dec 2, 2018

It seems the If block code is executed, libavcodec is 58.18.100

>scrcpy -v
scrcpy v1.5

dependencies:
 - SDL 2.0.9
 - libavcodec 58.18.100
 - libavformat 58.12.100
 - libavutil 56.14.100

@Gapplay
Copy link
Author

Gapplay commented Dec 9, 2018

I copied the file with ffmpeg and it fixed the metadata issue.

ffmpeg -i test.mp4 -c:v copy test_final.mp4

@rom1v
Copy link
Collaborator

rom1v commented Feb 9, 2019

@Gapplay Could you tell me whether this video has metadata issues, please? test.mp4

@Gapplay
Copy link
Author

Gapplay commented Feb 9, 2019

@rom1v that video is working correctly on all video players/programs I've tried.

@rom1v
Copy link
Collaborator

rom1v commented Feb 9, 2019

Great, then I have a fix 🎉

rom1v added a commit that referenced this issue Feb 9, 2019
When recording, the header must be written with extradata set to the
content of the very first packet.

Suggested-by: Steve Lhomme <robux4@ycbcr.xyz>

Fixes <#351>
Fixes <#416>
@rom1v
Copy link
Collaborator

rom1v commented Feb 9, 2019

Fixed on dev branch.

@rom1v rom1v closed this as completed Feb 9, 2019
@rom1v
Copy link
Collaborator

rom1v commented Feb 9, 2019

Thanks to my colleague @robUx4 who helped me a lot during the FOSDEM to fix this issue (and others which prevented recording to MKV, now it also works 🎉)

@HolisticDeveloper
Copy link

Do you have an ETA for when this might be released?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants