Jump to content


Photo

Emby having problems with AVI files

avi

  • Please log in to reply
43 replies to this topic

#21 ryandavidg OFFLINE  

ryandavidg

    Advanced Member

  • Members
  • 129 posts
  • Local time: 01:51 PM

Posted 09 January 2018 - 04:01 AM

I tried that and it turned a folder's worth of files into just one file. That damn program is complicated. I need a ELI5 version of directions for converting a whole seasons worth of AVIs into a whole seasons worth of MKVs

 

Yes, those instructions were for one file, which you could then test to see if it works on your server - as changing the container won't necessarily resolve playback issues, it's just worth trying in cases like this.

If you want to do lots of files, you can either:
- do them one by one using these same instructions, removing each source file entry in MKVToolnix after converting (right-click on the file in the file window and choose remove when you're done with it) then choosing the next one

- build them into a job queue (click on "add to job queue" instead of "start mutiplexing", then remove the file as above) then multiplex them all at once at the end

- A quick way to convert lots of files (in Windows) is to use a simple batch file to do them all at once using MKVMerge (which was installed as part of MKVToolnix). Simply copy the line below into notepad, then save in the directory with your avi files as CONVERTER.BAT (or anything .bat, just make sure it has the bat extension). If you did not install MKVToolnix in C:\Program Files then adjust that path first. Double click this bat file in windows explorer and it'll convert every AVI file in the directory. You can cut and paste the bat file to any other directory in future.

 

for %%a in (*.avi) do ("C:\Program Files\MKVtoolnix\mkvmerge.exe" -o "%%~na.mkv" "%%a")

 

Note that the above will place the MKV files in the same directory as the AVI source files. If you want them somewhere else then use this instead, where the D:\Movies\Converted can be replaced with whatever output directory you have set up for them.

 

for %%a in (*.avi) do ("C:\Program Files\MKVtoolnix\mkvmerge.exe" -o "D:\Movies\Converted\%%~na.mkv" "%%a")

 

 



#22 Arkieboy72472 OFFLINE  

Arkieboy72472

    Advanced Member

  • Members
  • 51 posts
  • Local time: 05:51 AM
  • LocationArkansas

Posted 09 January 2018 - 01:43 PM

What I have decided to do, and have yet to test, is to get the program Handbrake and just re-encode all of the first 3 seasons of Coach from AVI to MKV.

 

As long as I have VHS quality out of these older shows on my server, I am happy. As long as EMBY will play them, I am happy.

 

Long term, I will end up encoding everything I have that is AVI because it looks like the Roku and Emby doesn't like that format. Although this is one of the few things PLEX will do and not screw up, I am NOT going back to using that program. I have been phasing it out for a month or two and things went well until this issue showed up.

 

I found MKVmerge to damn complicated to use. The documentation is not user friendly. Handbrake is stupid simple.

 

I am willing to pay money and to go out of my way to make EMBY better because I am not going back to that other program.

 

I have a long road ahead re-encoding so much of my collection because these older, hard to find videos are usually encoded AVI and I have quite a bit. Hopefully as time goes on they will play better and without as much of an issue.

 

Thanks!


Edited by Arkieboy72472, 09 January 2018 - 01:43 PM.


#23 ryandavidg OFFLINE  

ryandavidg

    Advanced Member

  • Members
  • 129 posts
  • Local time: 01:51 PM

Posted 09 January 2018 - 01:50 PM

It's your choice obviously, I'd just point out that reencoding takes a long time and you lose quality reencoding. If you are comfortable using Handbrake I'd honestly just give the method I suggested above a try which is easier than messing with encoding settings... it just produces a bat file you can paste in every folder with AVIs you need to convert - then all you do is double click the bat file to process them.

 

But I'll leave it there, hope everything works out ok.

 

If you do try the process I outlined above and have issues feel free to pm me if you need assistance.


Edited by ryandavidg, 09 January 2018 - 01:51 PM.


#24 Waldonnis OFFLINE  

Waldonnis

    Advanced Member

  • Members
  • 652 posts
  • Local time: 07:51 AM

Posted 09 January 2018 - 02:45 PM

@Waldonnis this is an interesting one because it occurs when trying to stream copy both the video and audio and output with hls.

 

I think the video stream needs to be transcoded but making this decision is a little tricky. What I'm leaning towards right now is not allowing h264 stream copy from an avi container when the AVC flag is NO. These kinds of blanket bans are always difficult though because inevitably someone will come out of the woodwork and complain about the transcoding.

 

I'll take a look at it.  I've had nothing but problems with AVI files that contain h.264 streams historically, so my initial inclination is the same as yours.

 

Ugh, this isn't helping matters:

[FRAME]
pkt_pts=N/A
pkt_pts_time=N/A

Edited by Waldonnis, 09 January 2018 - 02:51 PM.


#25 Luke OFFLINE  

Luke

    System Architect

  • Administrators
  • 137604 posts
  • Local time: 07:51 AM

Posted 09 January 2018 - 02:54 PM

Yea I believe we used to never allow stream copy from avi but negative user feedback about transcoding forced us to adjust.

 

the frame data you mention is something we don't have though, but maybe you can spot something in the ffprobe output that could allow us to determine that a transcode is needed. t hanks.



#26 Arkieboy72472 OFFLINE  

Arkieboy72472

    Advanced Member

  • Members
  • 51 posts
  • Local time: 05:51 AM
  • LocationArkansas

Posted 09 January 2018 - 03:52 PM

I tested my first batch or re-encodes and they work great. Using the "Stats for Nerds" option on the web player shows that emby is happy which makes me happy.

 

Looking forward, I obviously will not re-encode anything that will play, but if it ain't broke, I won't be fixing it. I have about 3TB of stuff of various formats and I am only going to fix what my roku will not play, transcoded or not. All I want is a working stream regardless of how it gets done. I use an HP Z800 with dual 6 core Xeons for my family server so any performance hit is negligible.

 

I have found that, in Handbrake, you have 4 Roku Presets. The maxed out preset works on my roku premiere +, but I am going to try a few to see what works best and fastest. I only support 2 other guests that are family, so if theirs works and mine works, then I am golden.

 

So far I have learned that not AVI files will play. Some will and some won't for reasons that I do not know. If they won't, I just reencode them. If they will, great. Handbreak might not be the best fix, but it is easy and has actually saved me a bit of space. Losing a bit of quality on files doesn't bother me if they are watchable. I am supporting special needs people who just like to see 80's and 90's comedy shows and cartoons. I don't consider this case solved, but I am not smart enough, nor do I have the time to figure it all out. I have too much data to do it all, so I will just go with an as needed basis.

 

I love the support we get here from the Admins. This is why I am not going anywhere and why I will help others who may find themselves in my situation.



#27 Waldonnis OFFLINE  

Waldonnis

    Advanced Member

  • Members
  • 652 posts
  • Local time: 07:51 AM

Posted 09 January 2018 - 04:05 PM

Yea I believe we used to never allow stream copy from avi but negative user feedback about transcoding forced us to adjust.

 

the frame data you mention is something we don't have though, but maybe you can spot something in the ffprobe output that could allow us to determine that a transcode is needed. t hanks.

 

I'm not sure what there might be to look for, really.  Looking back at some of my test archive, I can't find an AVI file that contains h.264 that actually has is_avc set to 1, so that may not be a reliable indicator.

 

In this case, the lack of PTS will be problematic when remuxing to HLS.  I haven't tried it in an Emby context, but -fflags +genpts will probably be needed to create the streams' PTS values.  Unfortunately, the only way I can think of offhand to tell if this would be needed would be from looking at the first video frame's pkt_pts value (if it's N/A, it'll need timestamps), which isn't exactly the easiest or quickest thing to do during a probe.  Doesn't help that ffprobe's stream info for the video stream shows a 0 start_pts value, which doesn't match the frame dump info's "N/A" (audio does have PTS, which may be where that value is coming from).

 

@Arkieboy72472, AVI and Roku tend not to play well together (I say this as a fellow Roku owner, and I'm using a Roku to test this case right now because of that).  Still, I'm hopeful that Luke and I can figure out a way to get stream copies to work so you don't have to manually remux to mkv or mp4 if you don't want to...and I'm trying to avoid transcoding video entirely unless absolutely necessary.

 

Actually, I'll amend the above AVI and h.264 don't generally play well together  :P



#28 Luke OFFLINE  

Luke

    System Architect

  • Administrators
  • 137604 posts
  • Local time: 07:51 AM

Posted 09 January 2018 - 04:11 PM

@Waldonnis i also played with -fflags +genpts before the input -i

 

This allowed the ffmpeg process to successfully complete but the video was jumping around, as if it were repeatedly zooming in and out. Audio sounded fine.



#29 Waldonnis OFFLINE  

Waldonnis

    Advanced Member

  • Members
  • 652 posts
  • Local time: 07:51 AM

Posted 09 January 2018 - 05:03 PM

@Waldonnis i also played with -fflags +genpts before the input -i

 

This allowed the ffmpeg process to successfully complete but the video was jumping around, as if it were repeatedly zooming in and out. Audio sounded fine.

 

Yeah, it is stutter-y on review compared to the original. I'll keep playing with it.  The output from a remux using mkvmerge seemed okay, so I'm probably just forgetting something with ffmpeg.



#30 Arkieboy72472 OFFLINE  

Arkieboy72472

    Advanced Member

  • Members
  • 51 posts
  • Local time: 05:51 AM
  • LocationArkansas

Posted 09 January 2018 - 10:36 PM

I managed to get the offending files from a torrent. I can always grab them again so that you all can work with samples. Like I said earlier, not all AVI files I have are affected. I almost have all of the files reencoded. Every smart device in my house is a roku of some sort. This issue doesn't affect the web version of emby. I am glad you all are coming up with a solution as AVI is a common file format.



#31 Happy2Play OFFLINE  

Happy2Play

    Trial and Error

  • Moderators
  • 15620 posts
  • Local time: 04:51 AM
  • LocationWashington State

Posted 09 January 2018 - 10:42 PM

I managed to get the offending files from a torrent. I can always grab them again so that you all can work with samples. Like I said earlier, not all AVI files I have are affected. I almost have all of the files reencoded. Every smart device in my house is a roku of some sort. This issue doesn't affect the web version of emby. I am glad you all are coming up with a solution as AVI is a common file format.

 

Can you compare codecs of ones that are and are not affected..


Edited by Happy2Play, 09 January 2018 - 10:42 PM.


#32 Doofus ONLINE  

Doofus

    Advanced Member

  • Members
  • 12242 posts
  • Local time: 04:51 AM

Posted 09 January 2018 - 11:48 PM

Thanks for the heads up. I am going to try and zip the file and send it.

 

Well, for what it's worth, I'm testing playing that video. I tried in the web app, Theater desktop, Theater store app and the Android mobile app (forcing transcoding and direct play). It played correctly, every time. I can't get it to not play.



#33 Waldonnis OFFLINE  

Waldonnis

    Advanced Member

  • Members
  • 652 posts
  • Local time: 07:51 AM

Posted 10 January 2018 - 12:53 AM

Well, for what it's worth, I'm testing playing that video. I tried in the web app, Theater desktop, Theater store app and the Android mobile app (forcing transcoding and direct play). It played correctly, every time. I can't get it to not play.

 

It's probably just the Roku.  My Android phone was fine, as was web playback on my Windows partition.  Still, if it doesn't direct play on the Roku, a solution should be found to transcode or remux it so it can.  It's just finding the right options that's proving tricky.

 

AVI is a common format, but I wish it wasn't...frequently  :P  I refuse to even use AVI output from the various tools and editors I've used because of the limitations of the container and past problems with it.  Oddly, a remux to mp4 looked much better, so something's different in how the various muxers are handling the stream's information.  I too would like to know what the difference is from AVI files aren't showing the issue.  Maybe I'll take one of my non-AVI-contained h.264 samples and remux to AVI to see if they end up in a more HLS-friendly state and compare from there.



#34 Doofus ONLINE  

Doofus

    Advanced Member

  • Members
  • 12242 posts
  • Local time: 04:51 AM

Posted 10 January 2018 - 01:02 AM

Yeah, it's a crappy container, for sure. If it's remuxed to MKV, does it still have problems? If not, maybe it's easier to just have a blanket instruction to remux all AVI, regardless.



#35 Waldonnis OFFLINE  

Waldonnis

    Advanced Member

  • Members
  • 652 posts
  • Local time: 07:51 AM

Posted 10 January 2018 - 01:48 AM

Yeah, it's a crappy container, for sure. If it's remuxed to MKV, does it still have problems? If not, maybe it's easier to just have a blanket instruction to remux all AVI, regardless.

 

Yes and no.  The PTS/DTS differences between the ffmpeg (with genpts) and mkvmerge output aren't what I expected to see, and playback of ffmpeg's output is jerky (mkvmerge's is fine).  I've been distracted most of the night, so I still have a lot of things to look at and try.

 

Edit: As stated before, the mp4 remux plays fine, and both pkt_dts and pkt_pts appear to have been completely (re)generated (pkt_dts is the same as the original).  The same cannot be said for the matroska or mpegts remuxes (the mpegts frames' timestamps are even stranger than the matroska file).  I'm wondering if there's a problem with the best effort timestamp estimation with this particular input container/codec combo and it not having PTS set.  I did find a bug report from years ago that was similar, but it had ordering issues as well that don't apply here.  I've also found some discussion indicating that nobody has ever really addressed these cases on the avcodec/ffmpeg side, but didn't look at the code to see if that was the case.

 

I know timestamp generation for h.264 is difficult since it supports variable framerate, but why there's a difference in muxers' output is puzzling without looking deeply at the code.  I'd say that remuxing to matroska file-wise may not be the best idea unless you use mkvmerge (which seems to do it well).  I have no idea what to do with HLS (using mpegts segments) yet, though, as I haven't done many tests with it yet.


Edited by Waldonnis, 10 January 2018 - 03:06 AM.

  • Doofus likes this

#36 Arkieboy72472 OFFLINE  

Arkieboy72472

    Advanced Member

  • Members
  • 51 posts
  • Local time: 05:51 AM
  • LocationArkansas

Posted 10 January 2018 - 10:41 AM

Can you compare codecs of ones that are and are not affected..

 

I have deleted the old files. Here is what I can try: Fire up a few videos in roku that I know are AVI. Take note of the how they play and how they are encoded. I will report back and you all can make heads or tails of it.



#37 Arkieboy72472 OFFLINE  

Arkieboy72472

    Advanced Member

  • Members
  • 51 posts
  • Local time: 05:51 AM
  • LocationArkansas

Posted 10 January 2018 - 10:49 AM

Yeah, it's a crappy container, for sure. If it's remuxed to MKV, does it still have problems? If not, maybe it's easier to just have a blanket instruction to remux all AVI, regardless.

 

I have reencoded all files to either MKV or M4V and they all work great. The stats show that they now play directly.



#38 Doofus ONLINE  

Doofus

    Advanced Member

  • Members
  • 12242 posts
  • Local time: 04:51 AM

Posted 10 January 2018 - 11:49 AM

I have reencoded all files to either MKV or M4V and they all work great. The stats show that they now play directly.


Transcoding them probably wasn't necessary. Remuxing would probably have worked.

#39 Abobader OFFLINE  

Abobader

    Super-Tester

  • Administrators
  • 9401 posts
  • Local time: 02:51 PM

Posted 11 January 2018 - 07:15 AM

Well, for what it's worth, I'm testing playing that video. I tried in the web app, Theater desktop, Theater store app and the Android mobile app (forcing transcoding and direct play). It played correctly, every time. I can't get it to not play.

 

+1

 

Same here, I test many old movies (old one) I have, and all of them played without problem, I was hoping to find one, but could not.



#40 mirkwood OFFLINE  

mirkwood

    Newbie

  • Members
  • 4 posts
  • Local time: 06:51 AM

Posted 24 February 2018 - 07:41 PM

Thanks for the MKVToolnix call out.  Very helpful!







Also tagged with one or more of these keywords: avi

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users